Petals can now be buried via right clicking and emit particles when done so.

This commit is contained in:
Vasco Lavos committed 2014-06-28 19:38:09 +01:00
1 parent 5117c1d660
commit e197ba22f4
9 files changed
+109 -3

No files matched your search

@@ -122,10 +122,19 @@ public class ClientProxy extends CommonProxy {
return Minecraft.getMinecraft().theWorld == null ? 0 : Minecraft.getMinecraft().theWorld.getTotalWorldTime();
}
private static boolean noclipEnabled = false;
@Override
public void setSparkleFXNoClip(boolean noclip) {
noclipEnabled = noclip;
}
@Override
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
FXSparkle sparkle = new FXSparkle(world, x, y, z, size, r, g, b, m);
sparkle.fake = sparkle.noClip = fake;
if(noclipEnabled)
sparkle.noClip = true;
Minecraft.getMinecraft().effectRenderer.addEffect(sparkle);
}
@@ -0,0 +1,70 @@
/**
* This class was created by <Vazkii>. 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 @ [Jun 28, 2014, 6:43:33 PM (GMT)]
*/
package vazkii.botania.common.block;
import java.util.Random;
import net.minecraft.block.BlockBush;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockBuriedPetals extends BlockModFlower {
public BlockBuriedPetals() {
super(LibBlockNames.BURIED_PETALS);
setBlockBounds(0F, 0F, 0F, 1F, 0.1F, 1F);
}
@Override
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
int meta = par1World.getBlockMetadata(par2, par3, par4);
float[] color = EntitySheep.fleeceColorTable[meta];
Botania.proxy.setSparkleFXNoClip(true);
Botania.proxy.sparkleFX(par1World, par2 + 0.3 + par5Random.nextFloat() * 0.5, par3 + 0.1 + par5Random.nextFloat() * 0.1, par4 + 0.3 + par5Random.nextFloat() * 0.5, color[0], color[1], color[2], par5Random.nextFloat(), 5);
Botania.proxy.setSparkleFXNoClip(false);
}
@Override
boolean registerInCreative() {
return false;
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
blockIcon = IconHelper.forBlock(par1IconRegister, this);
}
@Override
public IIcon getIcon(int par1, int par2) {
return blockIcon;
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return ModItems.petal;
}
@Override
public int getRenderType() {
return 0;
}
}
@@ -53,9 +53,12 @@ public class BlockModFlower extends BlockFlower implements ILexiconable {
setStepSound(soundTypeGrass);
setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F);
setTickRandomly(true);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setCreativeTab(registerInCreative() ? BotaniaCreativeTab.INSTANCE : null);
}
boolean registerInCreative() {
return true;
}
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
@@ -125,6 +125,7 @@ public final class ModBlocks {
public static Block conjurationCatalyst;
public static Block bifrost;
public static Block solidVines;
public static Block buriedPetals;
public static Block livingwoodStairs;
public static Block livingwoodSlab;
@@ -201,6 +202,7 @@ public final class ModBlocks {
conjurationCatalyst = new BlockConjurationCatalyst();
bifrost = new BlockBifrost();
solidVines = new BlockSolidVines();
buriedPetals = new BlockBuriedPetals();
livingwoodStairs = new BlockLivingwoodStairs();
livingwoodSlab = new BlockLivingwoodSlab(false);
@@ -103,7 +103,11 @@ public class CommonProxy {
public long getWorldElapsedTicks() {
return MinecraftServer.getServer().worldServers[0].getTotalWorldTime();
}
public void setSparkleFXNoClip(boolean noclip) {
// NO-OP
}
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
sparkleFX(world, x, y, z, r, g, b, size, m, false);
}
@@ -11,9 +11,12 @@
*/
package vazkii.botania.common.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import vazkii.botania.api.recipe.IFlowerComponent;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.lib.LibItemNames;
public class ItemPetal extends Item16Colors implements IFlowerComponent {
@@ -22,6 +25,20 @@ public class ItemPetal extends Item16Colors implements IFlowerComponent {
super(LibItemNames.PETAL);
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
ItemStack stackToPlace = new ItemStack(ModBlocks.buriedPetals, 1, par1ItemStack.getItemDamage());
stackToPlace.tryPlaceItemIntoWorld(par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
if(stackToPlace.stackSize == 0) {
if(!par2EntityPlayer.capabilities.isCreativeMode)
par1ItemStack.stackSize--;
return true;
}
return false;
}
@Override
public boolean canFit(ItemStack stack, IInventory apothecary) {
return true;
@@ -44,6 +44,7 @@ public final class LibBlockNames {
public static final String CONJURATION_CATALYST = "conjurationCatalyst";
public static final String BIFROST = "bifrost";
public static final String SOLID_VINE = "solidVine";
public static final String BURIED_PETALS = "buriedPetals";
public static final String SPECIAL_FLOWER_PREFIX = FLOWER + ".";
+1 -1
View File
@@ -566,7 +566,7 @@ botania.page.lexicon2=The &1Lexica Botania&0's title can also be customized. By
botania.entry.flowers=Mystical Flowers
botania.page.flowers0=Around the world, you may stumble upon a large variety of Mystical Flora. Spotting these doesn't take much work as the flowers themselves emit a fair amount of shine.<br>They come in a total of &416 &0different colors.<br>It's also possible to grow these flowers using &1Floral Fertlizer&0 (read on).
botania.page.flowers1=Flowers as far as the eye can see...
botania.page.flowers2=These flowers can be plucked for &1Mystical Petals&0, that can be used for making magical instruments and plants alike.<br>These petals can also be crushed into &1Floral Powder&0, by the use of a &1Pestle and Mortar&0, which functions much alike any mundane piece of dye.
botania.page.flowers2=These flowers can be plucked for &1Mystical Petals&0, that can be used for making magical instruments and plants alike.<br>Right clicking a petal on the ground will &4bury it&0, having it emit particles.<br>These petals can also be crushed into &1Floral Powder&0, which functions much alike any mundane piece of dye.
botania.page.flowers3=Plucking Petals off Flowers.
botania.page.flowers4=Crafting the &1Pestle and Mortar&0.
botania.page.flowers5=Grinding Petals into Powder.
Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B