diff --git a/src/main/java/vazkii/botania/common/block/BlockModDoubleFlower.java b/src/main/java/vazkii/botania/common/block/BlockModDoubleFlower.java index 4a431c1c1..84c339e95 100644 --- a/src/main/java/vazkii/botania/common/block/BlockModDoubleFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockModDoubleFlower.java @@ -14,9 +14,23 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -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.BlockDoublePlant; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemShears; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.event.ForgeEventFactory; import vazkii.botania.api.lexicon.ILexiconable; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.client.core.helper.IconHelper; @@ -27,26 +41,15 @@ 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 net.minecraft.block.Block; -import net.minecraft.block.BlockDoublePlant; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.IShearable; +import cpw.mods.fml.common.registry.GameRegistry; public class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable { private static final int COUNT = 8; - + IIcon[] doublePlantTopIcons, doublePlantBottomIcons; final int offset; - + public BlockModDoubleFlower(boolean second) { offset = second ? 8 : 0; setBlockName(LibBlockNames.DOUBLE_FLOWER + (second ? 2 : 1)); @@ -64,17 +67,48 @@ public class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconab } @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { - ItemStack stack = new ItemStack(ModBlocks.flower, 1, (metadata & 7) + offset); - ArrayList list = new ArrayList(); - list.add(stack); - return list; + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return null; + } + + @Override + public int damageDropped(int p_149692_1_) { + return p_149692_1_ & 7; + } + + @Override + public void func_149889_c(World p_149889_1_, int p_149889_2_, int p_149889_3_, int p_149889_4_, int p_149889_5_, int p_149889_6_) { + p_149889_1_.setBlock(p_149889_2_, p_149889_3_, p_149889_4_, this, p_149889_5_, p_149889_6_); + p_149889_1_.setBlock(p_149889_2_, p_149889_3_ + 1, p_149889_4_, this, p_149889_5_ | 8, p_149889_6_); + } + + @Override + public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { + int l = ((MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4; + p_149689_1_.setBlock(p_149689_2_, p_149689_3_ + 1, p_149689_4_, this, p_149689_6_.getItemDamage() | 8, 2); + } + + @Override + public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) { + return true; + } + + @Override + public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) { + ArrayList ret = new ArrayList(); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 7)); + return ret; } + @Override + public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) { + return new ArrayList(); + } + @Override public IIcon getIcon(int p_149691_1_, int p_149691_2_) { - return (func_149887_c(p_149691_2_) ? doublePlantTopIcons : doublePlantBottomIcons)[p_149691_2_ & 7]; - } + return (func_149887_c(p_149691_2_) ? doublePlantTopIcons : doublePlantBottomIcons)[p_149691_2_ & 7]; + } @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { @@ -82,10 +116,10 @@ public class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconab boolean top = func_149887_c(meta); if(top) meta = world.getBlockMetadata(x, y - 1, z); - + return (top ? doublePlantBottomIcons : doublePlantTopIcons)[meta & 7]; } - + @Override public void registerBlockIcons(IIconRegister register) { doublePlantTopIcons = new IIcon[COUNT]; @@ -96,18 +130,18 @@ public class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconab doublePlantBottomIcons[i] = IconHelper.forName(register, "flower" + off + "Tall1"); } } - + @Override public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { - for(int i = 0; i < COUNT; ++i) - p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); - } + for(int i = 0; i < COUNT; ++i) + p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); + } @Override public int getRenderType() { return LibRenderIDs.idDoubleFlower; } - + @Override public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { int meta = par1World.getBlockMetadata(par2, par3, par4); @@ -121,9 +155,9 @@ public class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconab public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { return LexiconData.flowers; } - + int offset(int meta) { return meta + offset; } - + } diff --git a/src/main/java/vazkii/botania/common/block/BlockModFlower.java b/src/main/java/vazkii/botania/common/block/BlockModFlower.java index c393e1361..4d54628d8 100644 --- a/src/main/java/vazkii/botania/common/block/BlockModFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockModFlower.java @@ -15,6 +15,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockFlower; +import net.minecraft.block.IGrowable; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; @@ -41,7 +42,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement { +public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable { public static IIcon[] icons; public static IIcon[] iconsAlt; @@ -131,4 +132,24 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup public Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item) { return ModAchievements.flowerPickup; } + + @Override + public boolean func_149851_a(World world, int x, int y, int z, boolean fuckifiknow) { + return world.isAirBlock(x, y + 1, z); + } + + @Override + public boolean func_149852_a(World world, Random rand, int x, int y, int z) { + return func_149851_a(world, x, y, z, false); + } + + @Override + public void func_149853_b(World world, Random rand, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + Block flower = meta >= 8 ? ModBlocks.doubleFlower2 : ModBlocks.doubleFlower1; + int placeMeta = meta & 7; + world.setBlock(x, y, z, flower, placeMeta, 1 | 2); + world.setBlock(x, y + 1, z, flower, placeMeta | 8, 1 | 2); + } + } diff --git a/src/main/java/vazkii/botania/common/block/ModBlocks.java b/src/main/java/vazkii/botania/common/block/ModBlocks.java index df203bf3f..b8b4ab0de 100644 --- a/src/main/java/vazkii/botania/common/block/ModBlocks.java +++ b/src/main/java/vazkii/botania/common/block/ModBlocks.java @@ -286,6 +286,11 @@ public final class ModBlocks { OreDictionary.registerOre(LibOreDict.LIVING_WOOD, livingwood); OreDictionary.registerOre(LibOreDict.DREAM_WOOD, dreamwood); + for(int i = 0; i < 8; i++) { + OreDictionary.registerOre(LibOreDict.DOUBLE_FLOWER[i], new ItemStack(doubleFlower1, 1, i)); + OreDictionary.registerOre(LibOreDict.DOUBLE_FLOWER[i + 8], new ItemStack(doubleFlower2, 1, i)); + } + // Vanilla OreDict entries OreDictionary.registerOre("dirt", Blocks.dirt); OreDictionary.registerOre("grass", Blocks.grass); diff --git a/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java b/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java index b9306e241..f2f624781 100644 --- a/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java @@ -14,6 +14,7 @@ import net.minecraftforge.event.terraingen.DecorateBiomeEvent; import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType; import vazkii.botania.api.item.IFlowerlessBiome; import vazkii.botania.api.item.IFlowerlessWorld; +import vazkii.botania.common.block.BlockModFlower; import vazkii.botania.common.block.ModBlocks; import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.EventPriority; @@ -34,18 +35,24 @@ public class BiomeDecorationHandler { return; 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); + if(event.rand.nextInt(ConfigHandler.flowerPatchChance) == 0) { + 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); - int color = event.rand.nextInt(16); - 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); + int color = event.rand.nextInt(16); + for(int j = 0; j < ConfigHandler.flowerDensity * ConfigHandler.flowerPatchChance; j++) { + int dist = ConfigHandler.flowerPatchSize; + int x1 = x + event.rand.nextInt(dist * 2) - dist; + int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4); + int z1 = z + event.rand.nextInt(dist * 2) - dist; - 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, color, 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, color, 2); + if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).func_149851_a(event.world, x1, y1, z1, false)) + ((BlockModFlower) ModBlocks.flower).func_149853_b(event.world, event.world.rand, x1, y1, z1); + } + } } } diff --git a/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java b/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java index b167a6fad..92a168775 100644 --- a/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java @@ -60,6 +60,9 @@ public final class ConfigHandler { public static int flowerQuantity = 2; public static int flowerDensity = 16; + public static int flowerPatchSize = 6; + public static int flowerPatchChance = 4; + public static double flowerTallChance = 0.1; public static int mushroomQuantity = 40; public static int potionIDSoulCross = 91; @@ -169,7 +172,16 @@ public final class ConfigHandler { desc = "The density of each Botania flower patch generated, defaults to 16, the lower the number, the less each patch will have."; flowerDensity = loadPropInt("worldgen.flower.density", desc, flowerDensity); + + desc = "The size of each Botania flower patch. The larger this is the farther the each patch can spread"; + flowerPatchSize = loadPropInt("worldgen.flower.patchSize", desc, flowerPatchSize); + desc = "The chance for a Botania flower patch to be generated. The higher this value is the less patches will exist and the more flower each will have."; + flowerPatchChance = loadPropInt("worldgen.flower.patchChance", desc, flowerPatchChance); + + desc = "The chance for a Botania flower generated in a patch to be a tall flowe. 0.1 is 10%, 1 is 100%."; + flowerTallChance = loadPropDouble("worldgen.flower.tallChance", desc, flowerTallChance); + desc = "The quantity of Botania mushrooms to generate underground, in the world, defaults to 40, the lower the number the less patches generate."; mushroomQuantity = loadPropInt("worldgen.mushroom.quantity", desc, mushroomQuantity); diff --git a/src/main/java/vazkii/botania/common/crafting/ModCraftingRecipes.java b/src/main/java/vazkii/botania/common/crafting/ModCraftingRecipes.java index 303518253..104ec151a 100644 --- a/src/main/java/vazkii/botania/common/crafting/ModCraftingRecipes.java +++ b/src/main/java/vazkii/botania/common/crafting/ModCraftingRecipes.java @@ -244,6 +244,7 @@ public final class ModCraftingRecipes { public static IRecipe recipePhantomInk; public static IRecipe recipePoolCart; public static IRecipe recipePump; + public static List recipesPetalsDouble; public static void init() { // Lexicon Recipe @@ -1618,6 +1619,11 @@ public final class ModCraftingRecipes { 'I', LibOreDict.MANA_STEEL, 'B', new ItemStack(Items.bucket)); recipePump = BotaniaAPI.getLatestAddedRecipe(); + + // Double Petal Recipes + for(int i = 0; i < 16; i++) + addShapelessOreDictRecipe(new ItemStack(ModItems.petal, 4, i), LibOreDict.DOUBLE_FLOWER[i]); + recipesPetalsDouble = BotaniaAPI.getLatestAddedRecipes(16); // Storage Block Recipes addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0), diff --git a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java index d38b1060e..6c8f8d544 100644 --- a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java +++ b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java @@ -268,7 +268,7 @@ public final class LexiconData { 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", ModCraftingRecipes.recipesPetals), new PageCraftingRecipe("4", ModCraftingRecipes.recipePestleAndMortar), new PageCraftingRecipe("5", ModCraftingRecipes.recipesDyes), - new PageText("6"), new PageCraftingRecipe("7", ModCraftingRecipes.recipeFertilizerPowder), new PageCraftingRecipe("8", ModCraftingRecipes.recipeFerilizerDye), new PageCraftingRecipe("9", ModCraftingRecipes.recipesPetalBlocks)).setIcon(new ItemStack(ModBlocks.flower, 1, 6)); + new PageText("6"), new PageCraftingRecipe("7", ModCraftingRecipes.recipeFertilizerPowder), new PageCraftingRecipe("8", ModCraftingRecipes.recipeFerilizerDye), new PageText("10"), new PageCraftingRecipe("11", ModCraftingRecipes.recipesPetalsDouble), new PageCraftingRecipe("9", ModCraftingRecipes.recipesPetalBlocks)).setIcon(new ItemStack(ModBlocks.flower, 1, 6)); 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 PageText("4"), new PageCraftingRecipe("5", ModCraftingRecipes.recipesApothecary)); diff --git a/src/main/java/vazkii/botania/common/lib/LibOreDict.java b/src/main/java/vazkii/botania/common/lib/LibOreDict.java index 5e4b8a365..05dd74ea1 100644 --- a/src/main/java/vazkii/botania/common/lib/LibOreDict.java +++ b/src/main/java/vazkii/botania/common/lib/LibOreDict.java @@ -45,25 +45,33 @@ public final class LibOreDict { "mysticFlowerPink", "mysticFlowerGray", "mysticFlowerLightGray", "mysticFlowerCyan", "mysticFlowerPurple", "mysticFlowerBlue", "mysticFlowerBrown", "mysticFlowerGreen", "mysticFlowerRed", - "mysticFlowerBlack", }; + "mysticFlowerBlack" }; + + public static final String[] DOUBLE_FLOWER = new String[] { "mysticFlowerWhiteDouble", + "mysticFlowerOrangeDouble", "mysticFlowerMagentaDouble", + "mysticFlowerLightBlueDouble", "mysticFlowerYellowDouble", "mysticFlowerLimeDouble", + "mysticFlowerPinkDouble", "mysticFlowerGrayDouble", "mysticFlowerLightGrayDouble", + "mysticFlowerCyanDouble", "mysticFlowerPurpleDouble", "mysticFlowerBlueDouble", + "mysticFlowerBrownDouble", "mysticFlowerGreenDouble", "mysticFlowerRedDouble", + "mysticFlowerBlackDouble" }; public static final String[] PETAL = new String[] { "petalWhite", "petalOrange", "petalMagenta", "petalLightBlue", "petalYellow", "petalLime", "petalPink", "petalGray", "petalLightGray", "petalCyan", "petalPurple", "petalBlue", "petalBrown", - "petalGreen", "petalRed", "petalBlack", }; + "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", }; + "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", }; + "manaPetalGreen", "manaPetalRed", "manaPetalBlack" }; public static final String[] RUNE = new String[] { "runeWaterB", "runeFireB", "runeEarthB", "runeAirB", "runeSpringB", diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index f12405db7..838c72138 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -1196,6 +1196,8 @@ botania.page.flowers5=Grinding Petals into Powder. botania.page.flowers6=Right clicking the &1Floral Powder&0 in any &1Wool&0 or &1Carpet&0 changes its color to the color of the powder.
By mixing the &1Floral Powder&0 with some &1Bone Meal&0, it's possible to create a different type of fertilizer. The &1Floral Fertlizer&0 will grow a small amount of &1Mystical Flowers&0 in the nearby vicinity, if you ever run low on them. botania.page.flowers7=Making fertilizer (any powder colors work) botania.page.flowers8=Using typical flower substances also works +botania.page.flowers10=There's also some taller variants of the typical &1Mystical Flowers&0, spread around the place. These can only be gathered with &1Shears&0, but can be used to obtain twice the amount of petals a normal flower would yield. They're a bit too big for dye, though.
They can be made manually by fertilizing a &1Mystical Flower&0 with &1Bone Meal&0. +botania.page.flowers11=Prepare for trouble botania.page.flowers9=Petals can also be made into blocks # -- PETAL APOTHECARY