Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mreyeballs29.issactncore.block;
- import java.util.Random;
- import mreyeballs29.issactncore.init.I29CBlocks;
- import net.minecraft.block.Block;
- import net.minecraft.block.BlockFalling;
- import net.minecraft.block.SoundType;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.init.Items;
- import net.minecraft.item.Item;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- public class BlockPlainConcretePowder extends BlockFalling {
- private Item item;
- public BlockPlainConcretePowder(Item concretePowder) {
- item = concretePowder;
- setSoundType(SoundType.SAND);
- }
- @Override
- public Item getItemDropped(IBlockState state, Random rand, int fortune) {
- return item != null ? item.delegate.get() : Items.AIR;
- }
- /**
- * @param state
- */
- protected boolean tryTouchWater(World worldIn, BlockPos pos, IBlockState state)
- {
- boolean flag = false;
- for (EnumFacing enumfacing : EnumFacing.values())
- {
- if (enumfacing != EnumFacing.DOWN)
- {
- BlockPos blockpos = pos.offset(enumfacing);
- if (worldIn.getBlockState(blockpos).getMaterial() == Material.WATER)
- {
- flag = true;
- break;
- }
- }
- }
- if (flag)
- {
- worldIn.setBlockState(pos, I29CBlocks.CONCRETE.getDefaultState(), 3);
- }
- return flag;
- }
- public void onEndFalling(World worldIn, BlockPos pos, IBlockState p_176502_3_, IBlockState p_176502_4_)
- {
- if (p_176502_4_.getMaterial().isLiquid())
- {
- worldIn.setBlockState(pos, I29CBlocks.CONCRETE.getDefaultState(), 3);
- }
- }
- public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
- {
- if (!this.tryTouchWater(worldIn, pos, state))
- {
- super.onBlockAdded(worldIn, pos, state);
- }
- }
- public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
- {
- if (!this.tryTouchWater(worldIn, pos, state))
- {
- super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
- }
- }
- @Override
- public int getDustColor(IBlockState state) {
- return 0xCDC9B2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement