From b7cc5b395c06db97776ef5b72732c52ae691786b Mon Sep 17 00:00:00 2001 From: Lizbeth Rika Date: Fri, 17 Apr 2015 13:37:52 +0100 Subject: [PATCH] Hydroangeas now get Daybloom/Nightshade like diminishing returns in all 8 directions. --- .../generating/SubTileHydroangeas.java | 32 +++++++++++++++++-- .../botania/common/lexicon/LexiconData.java | 2 +- .../resources/assets/botania/lang/en_US.lang | 1 + 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java index 477cfb166..cd9de5816 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java @@ -10,6 +10,7 @@ */ package vazkii.botania.common.block.subtile.generating; +import java.awt.Color; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -19,9 +20,11 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import vazkii.botania.api.lexicon.LexiconEntry; +import vazkii.botania.api.subtile.ISubTileContainer; import vazkii.botania.api.subtile.RadiusDescriptor; import vazkii.botania.common.Botania; import vazkii.botania.common.core.helper.ItemNBTHelper; @@ -91,6 +94,30 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating { } } + public int getSurroundingFlowers() { + int flowers = 0; + for(int[] offsetArray : OFFSETS) { + TileEntity tile = supertile.getWorldObj().getTileEntity(supertile.xCoord + offsetArray[0], supertile.yCoord, supertile.zCoord + offsetArray[1]); + if(tile != null && tile instanceof ISubTileContainer) { + ISubTileContainer flower = (ISubTileContainer) tile; + if(flower.getSubTile() != null && flower.getSubTile().getClass() == getClass()) { + flowers++; + + Color color = new Color(getColor()); + float r = color.getRed() / 255F; + float g = color.getGreen() / 255F; + float b = color.getBlue() / 255F; + + float m = 0.045F; + if(ticksExisted % 10 == 0) + Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.5, supertile.yCoord + 0.05, supertile.zCoord + 0.5, r, g, b, 0.1F, offsetArray[0] * m, 0, offsetArray[1] * m); + } + } + } + + return flowers; + } + 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); } @@ -102,7 +129,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating { public Block getBlockToSearchBelow() { return null; } - + public void playSound() { supertile.getWorldObj().playSoundEffect(supertile.xCoord, supertile.yCoord, supertile.zCoord, "random.drink", 0.02F, 0.5F + (float) Math.random() * 0.5F); } @@ -166,7 +193,8 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating { @Override public boolean canGeneratePassively() { - return burnTime > 0; + int adj = getSurroundingFlowers(); + return supertile.getWorldObj().rand.nextInt(adj + 1) == 0 && burnTime > 0; } @Override diff --git a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java index 005c2cda7..32c72d18f 100644 --- a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java +++ b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java @@ -475,7 +475,7 @@ public final class LexiconData { endoflame.setLexiconPages(new PageText("0"), new PageText("1"), new PagePetalRecipe("2", ModPetalRecipes.endoflameRecipe)); hydroangeas = new BLexiconEntry(LibLexicon.GFLOWER_HYDROANGEAS, categoryGenerationFlowers); - hydroangeas.setLexiconPages(new PageText(ConfigHandler.hardcorePassiveGeneration > 0 ? "0a" : "0"), new PageImage("2", LibResources.ENTRY_HYDROANGEAS), new PagePetalRecipe("1", ModPetalRecipes.hydroangeasRecipe)); + hydroangeas.setLexiconPages(new PageText(ConfigHandler.hardcorePassiveGeneration > 0 ? "0a" : "0"), new PageImage("2", LibResources.ENTRY_HYDROANGEAS), new PageText("3"), new PagePetalRecipe("1", ModPetalRecipes.hydroangeasRecipe)); thermalily = new BLexiconEntry(LibLexicon.GFLOWER_THERMALILY, categoryGenerationFlowers); thermalily.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.thermalilyRecipe)); diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index 808f4891a..ef69ebfac 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -1781,6 +1781,7 @@ botania.entry.hydroangeas=Hydroangeas botania.page.hydroangeas0=While passive &4Mana&0 generation can be easily achieved through &1Dayblooms&0, different means of doing so might come in handy. The &1Hydroangeas&0 will suck up any &1Still Water&0 in a 3x3 area around it, on the same height, creating &4Mana&0 from it. They also seem to function faster during &4Rain&0, who'd have thought? botania.page.hydroangeas0a=The &1Hydroangeas&0 will suck up any &1Still Water&0 in a 3x3 area around it, on the same height, creating &4Mana&0 from it. They also seem to function faster during &4Rain&0, who'd have thought?
Similarly to the &1Daybloom&0, these flowers are not very resistant, and after some time they'll wither and die off. botania.page.hydroangeas2=A simple &1Hydroangeas&0 system +botania.page.hydroangeas3=These flowers, similarly to &1Dayblooms&0 or &1Nightshades&0 will receive a portion of diminishing returns if put in too compact of a pattern. Having any two &1Hydroangeas&0 one block away from eachother, including diagonals, will drastically reduce the production rate of both, as the roots get tangled. Having even more in the short space will further weaken their potency. The blue particles between them indicate this. botania.page.hydroangeas1=&oFrom some Hyperdimension&r? # -- THERMALILY