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;
|
2020-01-29 01:34:58 +01:00
|
|
|
import de.ellpeck.naturesaura.reg.ICustomRenderType;
|
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;
|
2020-01-29 01:34:58 +01:00
|
|
|
import net.minecraft.client.renderer.RenderType;
|
2018-10-14 16:12:33 +02:00
|
|
|
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 01:34:58 +01:00
|
|
|
import java.util.function.Supplier;
|
2018-10-14 16:12:33 +02:00
|
|
|
|
2020-01-29 01:34:58 +01:00
|
|
|
public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState, ICustomRenderType {
|
2018-10-14 16:12:33 +02:00
|
|
|
|
|
|
|
public BlockDecayedLeaves() {
|
2020-01-29 01:34:58 +01:00
|
|
|
super("decayed_leaves", ModBlocks.prop(Material.LEAVES).hardnessAndResistance(0.2F).sound(SoundType.PLANT).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;
|
|
|
|
}
|
2020-01-29 01:34:58 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Supplier<RenderType> getRenderType() {
|
2020-09-22 03:17:02 +02:00
|
|
|
return RenderType::getCutoutMipped;
|
2020-01-29 01:34:58 +01:00
|
|
|
}
|
2018-10-14 16:12:33 +02:00
|
|
|
}
|