NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java

38 lines
1.3 KiB
Java
Raw Normal View History

2018-10-14 16:12:33 +02:00
package de.ellpeck.naturesaura.blocks;
2020-01-29 00:40:28 +01:00
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
2019-11-04 19:08:49 +01:00
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
2018-10-14 16:12:33 +02:00
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos;
2020-01-29 00:40:28 +01:00
import net.minecraft.world.IBlockReader;
2020-01-28 18:08:56 +01:00
import net.minecraft.world.server.ServerWorld;
2018-10-14 16:12:33 +02:00
import java.util.Random;
2020-01-29 00:40:28 +01:00
public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState {
2018-10-14 16:12:33 +02:00
public BlockDecayedLeaves() {
2020-01-29 00:40:28 +01:00
super("decayed_leaves", ModBlocks.prop(Material.LEAVES).hardnessAndResistance(0.2F).sound(SoundType.PLANT).variableOpacity().notSolid().tickRandomly());
2018-10-14 16:12:33 +02:00
}
2018-10-18 17:12:20 +02:00
@Override
2020-01-28 18:08:56 +01:00
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
2019-11-04 19:08:49 +01:00
if (!world.isRemote) {
world.setBlockState(pos, Blocks.AIR.getDefaultState());
2018-10-14 16:12:33 +02:00
}
}
2020-01-28 18:08:56 +01:00
2020-01-29 00:40:28 +01:00
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
}
@Override
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
return 1;
}
2018-10-14 16:12:33 +02:00
}