mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-05 12:59:08 +01:00
45 lines
1.5 KiB
Java
45 lines
1.5 KiB
Java
package de.ellpeck.naturesaura.blocks;
|
|
|
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
|
import de.ellpeck.naturesaura.reg.ICustomRenderType;
|
|
import net.minecraft.block.BlockState;
|
|
import net.minecraft.block.Blocks;
|
|
import net.minecraft.block.SoundType;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.RenderType;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.IBlockReader;
|
|
import net.minecraft.world.server.ServerWorld;
|
|
|
|
import java.util.Random;
|
|
import java.util.function.Supplier;
|
|
|
|
public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState, ICustomRenderType {
|
|
|
|
public BlockDecayedLeaves() {
|
|
super("decayed_leaves", ModBlocks.prop(Material.LEAVES).hardnessAndResistance(0.2F).sound(SoundType.PLANT).notSolid().tickRandomly());
|
|
}
|
|
|
|
@Override
|
|
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
|
if (!world.isRemote) {
|
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
|
}
|
|
}
|
|
|
|
@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;
|
|
}
|
|
|
|
@Override
|
|
public Supplier<RenderType> getRenderType() {
|
|
return RenderType::getCutoutMipped;
|
|
}
|
|
}
|