From 2eb47178fac6cdaa65587ebb9bda00897fd2e83d Mon Sep 17 00:00:00 2001 From: Lizbeth Rika Date: Tue, 27 Jan 2015 19:00:11 +0000 Subject: [PATCH] Added the Spectranthemum flower. --- .../common/block/BlockSpecialFlower.java | 3 +- .../botania/common/block/ModBlocks.java | 2 + .../functional/SubTileSpectranthemum.java | 123 ++++++++++++++++++ .../common/crafting/ModPetalRecipes.java | 6 +- .../botania/common/lexicon/LexiconData.java | 4 + .../botania/common/lib/LibBlockNames.java | 2 + .../vazkii/botania/common/lib/LibLexicon.java | 1 + .../resources/assets/botania/lang/en_US.lang | 9 ++ 8 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 src/main/java/vazkii/botania/common/block/subtile/functional/SubTileSpectranthemum.java diff --git a/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java b/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java index 763eaeded..b6665042c 100644 --- a/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java @@ -87,7 +87,8 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid LibBlockNames.SUBTILE_CLAYCONIA, LibBlockNames.SUBTILE_LOONIUM, LibBlockNames.SUBTILE_DAFFOMILL, - LibBlockNames.SUBTILE_VINCULOTUS + LibBlockNames.SUBTILE_VINCULOTUS, + LibBlockNames.SUBTILE_SPECTRANTHEMUM })); } diff --git a/src/main/java/vazkii/botania/common/block/ModBlocks.java b/src/main/java/vazkii/botania/common/block/ModBlocks.java index b0af11639..abaea7e3e 100644 --- a/src/main/java/vazkii/botania/common/block/ModBlocks.java +++ b/src/main/java/vazkii/botania/common/block/ModBlocks.java @@ -75,6 +75,7 @@ import vazkii.botania.common.block.subtile.functional.SubTileJiyuulia; import vazkii.botania.common.block.subtile.functional.SubTileLoonuim; import vazkii.botania.common.block.subtile.functional.SubTilePollidisiac; import vazkii.botania.common.block.subtile.functional.SubTileRannuncarpus; +import vazkii.botania.common.block.subtile.functional.SubTileSpectranthemum; import vazkii.botania.common.block.subtile.functional.SubTileTangleberrie; import vazkii.botania.common.block.subtile.functional.SubTileTigerseye; import vazkii.botania.common.block.subtile.functional.SubTileVinculotus; @@ -345,6 +346,7 @@ public final class ModBlocks { BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_LOONIUM, SubTileLoonuim.class); BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DAFFOMILL, SubTileDaffomill.class); BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_VINCULOTUS, SubTileVinculotus.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_SPECTRANTHEMUM, SubTileSpectranthemum.class); } private static void registerTile(Class clazz, String key) { diff --git a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileSpectranthemum.java b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileSpectranthemum.java new file mode 100644 index 000000000..9405237af --- /dev/null +++ b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileSpectranthemum.java @@ -0,0 +1,123 @@ +/** + * 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, 2015, 4:06:58 PM (GMT)] + */ +package vazkii.botania.common.block.subtile.functional; + +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; +import vazkii.botania.api.lexicon.LexiconEntry; +import vazkii.botania.api.subtile.SubTileFunctional; +import vazkii.botania.common.lexicon.LexiconData; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class SubTileSpectranthemum extends SubTileFunctional { + + private static final int COST = 24; + int bindX, bindY = -1, bindZ; + + @Override + public void onUpdate() { + super.onUpdate(); + + if(redstoneSignal == 0 && supertile.getWorldObj().blockExists(bindX, bindY, bindZ)) { + int range = 2; + + int x = supertile.xCoord; + int y = supertile.yCoord; + int z = supertile.zCoord; + + boolean did = false; + List items = supertile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - range, y - range, z - range, x + range + 1, y + range, z + range + 1)); + for(EntityItem item : items) { + if(item.age < 60 || item.isDead) + continue; + + ItemStack stack = item.getEntityItem(); + if(stack != null) { + int cost = stack.stackSize * COST; + if(mana >= cost) { + spawnExplosionParticles(item); + item.setPosition(bindX + 0.5, bindY + 1.5, bindZ + 0.5); + item.motionX = item.motionY = item.motionZ = 0; + spawnExplosionParticles(item); + if(!supertile.getWorldObj().isRemote) { + mana -= cost; + did = true; + } + } + } + } + + if(did) + sync(); + } + } + + void spawnExplosionParticles(EntityItem item) { + for(int i = 0; i < 10; i++) { + double m = 0.01; + double d0 = item.worldObj.rand.nextGaussian() * m; + double d1 = item.worldObj.rand.nextGaussian() * m; + double d2 = item.worldObj.rand.nextGaussian() * m; + double d3 = 10.0D; + item.worldObj.spawnParticle("explode", item.posX + (double)(item.worldObj.rand.nextFloat() * item.width * 2.0F) - (double)item.width - d0 * d3, item.posY + (double)(item.worldObj.rand.nextFloat() * item.height) - d1 * d3, item.posZ + (double)(item.worldObj.rand.nextFloat() * item.width * 2.0F) - (double)item.width - d2 * d3, d0, d1, d2); + } + } + + @Override + public boolean acceptsRedstone() { + return true; + } + + @Override + public int getColor() { + return 0x98BCFF; + } + + @Override + public int getMaxMana() { + return 16000; + } + + @Override + public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) { + boolean bound = super.bindTo(player, wand, x, y, z, side); + if(!bound && (x != bindX || y != bindY || z != bindZ) && (x != supertile.xCoord || y != supertile.yCoord || z != supertile.zCoord)) { + bindX = x; + bindY = y; + bindZ = z; + sync(); + + return true; + } + + return bound; + } + + @Override + @SideOnly(Side.CLIENT) + public ChunkCoordinates getBinding() { + return (Minecraft.getMinecraft().thePlayer.isSneaking() && bindY != -1) ? new ChunkCoordinates(bindX, bindY, bindZ) : super.getBinding(); + } + + @Override + public LexiconEntry getEntry() { + return LexiconData.spectranthemum; + } + +} diff --git a/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java b/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java index a7a9a458d..76a4a77ff 100644 --- a/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java +++ b/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java @@ -63,7 +63,8 @@ public final class ModPetalRecipes { public static RecipePetals looniumRecipe; public static RecipePetals daffomillRecipe; public static RecipePetals vinculotusRecipe; - + public static RecipePetals spectranthemumRecipe; + public static void init() { pureDaisyRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), white, white, white, white); manastarRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_MANASTAR), lightBlueMana, greenMana, redMana, cyanMana); @@ -99,7 +100,8 @@ public final class ModPetalRecipes { looniumRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_LOONIUM), green, green, greenMana, greenMana, gray, grayMana, runeSloth, runeGluttony, runeEnvy, redstoneRoot, pixieDust); daffomillRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_DAFFOMILL), white, whiteMana, brown, yellowMana, runeAir, redstoneRoot); vinculotusRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_VINCULOTUS), purpleMana, purpleMana, lime, black, blackMana, black, runeWater, runeSloth, runeLust, redstoneRoot); - + spectranthemumRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_SPECTRANTHEMUM), whiteMana, whiteMana, white, white, cyan, runeEnvy, runeWater, redstoneRoot, pixieDust); + ItemStack stack = new ItemStack(Items.skull, 1, 3); ItemNBTHelper.setString(stack, "SkullOwner", "Vazkii"); Object[] inputs = new Object[16]; diff --git a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java index fbe4dfbc6..1c48472b9 100644 --- a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java +++ b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java @@ -91,6 +91,7 @@ public final class LexiconData { public static LexiconEntry loonium; public static LexiconEntry daffomill; public static LexiconEntry vinculotus; + public static LexiconEntry spectranthemum; public static LexiconEntry generatingIntro; public static LexiconEntry daybloom; @@ -389,6 +390,9 @@ public final class LexiconData { vinculotus = new BLexiconEntry(LibLexicon.FFLOWER_VINCULOTUS, categoryFunctionalFlowers); vinculotus.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.vinculotusRecipe)); + spectranthemum = new ALexiconEntry(LibLexicon.FFLOWER_SPECTRANTHEMUN, categoryFunctionalFlowers); + spectranthemum.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PagePetalRecipe("3", ModPetalRecipes.spectranthemumRecipe)); + // GENERATING FLOWERS ENTRIES generatingIntro = new BLexiconEntry(LibLexicon.GFLOWER_INTRO, categoryGenerationFlowers); generatingIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")); diff --git a/src/main/java/vazkii/botania/common/lib/LibBlockNames.java b/src/main/java/vazkii/botania/common/lib/LibBlockNames.java index 0c137b3c9..8ea1c491c 100644 --- a/src/main/java/vazkii/botania/common/lib/LibBlockNames.java +++ b/src/main/java/vazkii/botania/common/lib/LibBlockNames.java @@ -103,6 +103,8 @@ public final class LibBlockNames { public static final String SUBTILE_LOONIUM = "loonium"; public static final String SUBTILE_DAFFOMILL = "daffomill"; public static final String SUBTILE_VINCULOTUS = "vinculotus"; + public static final String SUBTILE_SPECTRANTHEMUM = "spectranthemum"; + public static final String SUBTILE_MEDUMONE = "medumone"; public static final String QUARTZ_DARK = "Dark"; public static final String QUARTZ_MANA = "Mana"; diff --git a/src/main/java/vazkii/botania/common/lib/LibLexicon.java b/src/main/java/vazkii/botania/common/lib/LibLexicon.java index 6543cc263..ddd83aa84 100644 --- a/src/main/java/vazkii/botania/common/lib/LibLexicon.java +++ b/src/main/java/vazkii/botania/common/lib/LibLexicon.java @@ -72,6 +72,7 @@ public final class LibLexicon { public static final String FFLOWER_LOONIUM = "loonium"; public static final String FFLOWER_DAFFOMILL = "daffomill"; public static final String FFLOWER_VINCULOTUS = "vinculotus"; + public static final String FFLOWER_SPECTRANTHEMUN = "spectranthemum"; public static final String GFLOWER_INTRO = "gIntro"; public static final String GFLOWER_DAYBLOOM = "daybloom"; diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index 6dd0001c5..2cb3bfa73 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -581,6 +581,8 @@ tile.botania:flower.daffomill.name=Daffomill tile.botania:flower.daffomill.reference=Cook's Assistant tile.botania:flower.vinculotus.name=Vinculotus tile.botania:flower.vinculotus.reference=Totally an Extra Utils ripoff +tile.botania:flower.spectranthemum.name=Spectranthemum +tile.botania:flower.spectranthemum.reference=In the shell # ITEM NAMES item.botania:lexicon.name=Lexica Botania @@ -1201,6 +1203,13 @@ botania.entry.vinculotus=Vinculotus botania.page.vinculotus0=The &1Vinculotus&0 has the power to create a disturbance among any &4Enderman&0's teleportation powers within a fairly large radius around it. For a cost of &4Mana&0, whenever an &4Enderman&0 would teleport anywhere, instead, they're teleported to the location of the &1Vinculotus&0. botania.page.vinculotus1=Touch this black lotus with your fingers +# -- SPECTRANTHEMUM +botania.entry.spectranthemum=Spectranthemum +botania.page.spectranthemum0=Transporting items a long distance can be an arduous task. Water channels and &1Daffomills&0 won't cut it forever.
The &1Spectranthemum&0, at the cost of &4Mana&0 wraps the fabric of reality of any dropped items around it, teleporting them somewhere else in the world. +botania.page.spectranthemum1=In order to specify where the items go, one would use a &1Wand of the Forest&0 in bind mode and bind the flower to a block somewhere, similarly to binding it to a pool.
In order to view what block the flower is bound to rather than the pool it's pulling &4Mana&0, one would sneak while looking at it with a wand. +botania.page.spectranthemum2=This flower is governed by the &4axiom of chunkloading&0, by which it'll not function on chunks not loaded. This topic is not addressed in full extent this lexicon.
&oRecommended Reading: "Chunks and Chicken", "Anchors of the World". +botania.page.spectranthemum3=(n)spooky(n+2)me + # - GENERATING FLOWERS # -- AN INTRODUCTION TO GENERATION botania.entry.gIntro=An Introduction to Generation