From d984873fdee12e13c90b6480b3225a45419e0001 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 16 Dec 2015 22:48:33 +0100 Subject: [PATCH] Smiley Cloud hearts --- .../blocks/BlockSmileyCloud.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java index 0d8f7fc22..2df74e9ca 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java @@ -18,6 +18,7 @@ import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud; import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -32,6 +33,8 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.Random; + public class BlockSmileyCloud extends BlockContainerBase{ public BlockSmileyCloud(String name){ @@ -39,6 +42,7 @@ public class BlockSmileyCloud extends BlockContainerBase{ this.setHardness(0.5F); this.setResistance(5.0F); this.setStepSound(soundTypeCloth); + this.setTickRandomly(true); } @Override @@ -131,6 +135,19 @@ public class BlockSmileyCloud extends BlockContainerBase{ super.breakBlock(world, x, y, z, block, par6); } + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random rand){ + if(Util.RANDOM.nextInt(30) == 0){ + for(int i = 0; i < 2; i++){ + double d = Util.RANDOM.nextGaussian()*0.02D; + double d1 = Util.RANDOM.nextGaussian()*0.02D; + double d2 = Util.RANDOM.nextGaussian()*0.02D; + world.spawnParticle("heart", x+Util.RANDOM.nextFloat(), y+0.65+Util.RANDOM.nextFloat(), z+Util.RANDOM.nextFloat(), d, d1, d2); + } + } + } + @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.rare;