Re-added Flesh block, tested particles for flowers
This commit is contained in:
parent
bb27856827
commit
b90b472cc3
|
@ -0,0 +1,61 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2019, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
package biomesoplenty.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import biomesoplenty.api.item.BOPItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Particles;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockFlesh extends Block
|
||||
{
|
||||
protected static final VoxelShape SHAPE = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D);
|
||||
|
||||
public BlockFlesh(Block.Builder properties)
|
||||
{
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(IBlockState state, IBlockReader worldIn, BlockPos pos)
|
||||
{
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemProvider getItemDropped(IBlockState state, World worldIn, BlockPos pos, int fortune)
|
||||
{
|
||||
return BOPItems.chunk_of_flesh;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(IBlockState state, Random random)
|
||||
{
|
||||
return random.nextInt(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(IBlockState state, World worldIn, BlockPos pos, Entity entityIn)
|
||||
{
|
||||
entityIn.motionX *= 0.95D;
|
||||
entityIn.motionZ *= 0.95D;
|
||||
}
|
||||
}
|
|
@ -7,9 +7,17 @@
|
|||
******************************************************************************/
|
||||
package biomesoplenty.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import biomesoplenty.api.block.BOPBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Particles;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockFlowerBOP extends BlockFlower
|
||||
{
|
||||
|
@ -17,4 +25,36 @@ public class BlockFlowerBOP extends BlockFlower
|
|||
{
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void animateTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
|
||||
{
|
||||
super.animateTick(stateIn, worldIn, pos, rand);
|
||||
Block block = stateIn.getBlock();
|
||||
|
||||
if (block == BOPBlocks.deathbloom)
|
||||
{
|
||||
if (rand.nextInt(4) == 0)
|
||||
{
|
||||
worldIn.addParticle(Particles.MYCELIUM, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + rand.nextFloat()), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (rand.nextInt(4) == 0)
|
||||
{
|
||||
worldIn.addParticle(Particles.SMOKE, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + rand.nextFloat()), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
if (block == BOPBlocks.burning_blossom)
|
||||
{
|
||||
if (rand.nextInt(4) == 0)
|
||||
{
|
||||
worldIn.addParticle(Particles.FLAME, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + rand.nextFloat()), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (rand.nextInt(2) == 0)
|
||||
{
|
||||
worldIn.addParticle(Particles.SMOKE, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + rand.nextFloat()), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ package biomesoplenty.init;
|
|||
import static biomesoplenty.api.block.BOPBlocks.*;
|
||||
|
||||
import biomesoplenty.common.block.BlockAsh;
|
||||
import biomesoplenty.common.block.BlockFlesh;
|
||||
import biomesoplenty.common.block.BlockFlowerBOP;
|
||||
import biomesoplenty.common.block.BlockFoliageBOP;
|
||||
import biomesoplenty.common.block.BlockLeavesBOP;
|
||||
|
@ -57,6 +58,7 @@ public class ModBlocks
|
|||
|
||||
dried_sand = registerBlock(new Block(Builder.create(Material.GROUND, MapColor.BROWN_TERRACOTTA).hardnessAndResistance(1.0F)), "dried_sand");
|
||||
ash_block = registerBlock(new BlockAsh(Builder.create(Material.SAND, MapColor.BLACK).hardnessAndResistance(0.4F).sound(SoundType.SAND)), "ash_block");
|
||||
flesh = registerBlock(new BlockFlesh(Builder.create(Material.SPONGE, MapColor.RED).hardnessAndResistance(0.4F).sound(SoundType.SLIME)), "flesh");
|
||||
|
||||
origin_sapling = registerBlock(new BlockPlantBOP(Block.Builder.create(Material.VINE).doesNotBlockMovement().zeroHardnessAndResistance().sound(SoundType.PLANT)), "origin_sapling");
|
||||
origin_leaves = registerBlock(new BlockLeavesBOP(Block.Builder.create(Material.LEAVES).hardnessAndResistance(0.2F).needsRandomTick().sound(SoundType.PLANT)), "origin_leaves");
|
||||
|
|
Loading…
Reference in New Issue