made golden leaves have sparkle particles when they're done

Closes #2
This commit is contained in:
Ellpeck 2018-11-11 17:09:26 +01:00
parent 1854b42709
commit dd126df00c

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.*; import de.ellpeck.naturesaura.reg.*;
import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockLeaves;
@ -62,6 +63,18 @@ public class BlockGoldenLeaves extends BlockLeaves implements
} }
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (stateIn.getValue(STAGE) == HIGHEST_STAGE && rand.nextFloat() >= 0.75F)
NaturesAuraAPI.instance().spawnMagicParticle(worldIn,
pos.getX() + rand.nextFloat(),
pos.getY() + rand.nextFloat(),
pos.getZ() + rand.nextFloat(),
0F, 0F, 0F,
0xF2FF00, 0.5F + rand.nextFloat(), 50, 0F, false, true);
}
@Override @Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
NonNullList<ItemStack> drops = NonNullList.create(); NonNullList<ItemStack> drops = NonNullList.create();