Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package rinart73.samplemod.blocks;
- import net.minecraft.block.Block;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.properties.IProperty;
- import net.minecraft.block.properties.PropertyBool;
- import net.minecraft.block.state.BlockStateContainer;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.IBlockAccess;
- import net.minecraft.world.World;
- public class AerialBlock extends Block {
- public static final PropertyBool SKY = PropertyBool.create("sky");
- public AerialBlock(String registryName, float hardness, float resistance) {
- super(Material.CLAY);
- this.setRegistryName(registryName);
- this.setUnlocalizedName(registryName);
- this.blockHardness = hardness;
- this.blockResistance = resistance;
- this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
- this.setDefaultState(this.blockState.getBaseState().withProperty(SKY, Boolean.valueOf(false)));
- }
- @Override
- public IBlockState getStateFromMeta(int meta) {
- return this.getDefaultState();
- }
- @Override
- public int getMetaFromState(IBlockState state) {
- return 0;
- }
- @Override
- protected BlockStateContainer createBlockState() {
- return new BlockStateContainer(this, new IProperty[]{ SKY });
- }
- @Override
- public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
- boolean seesSky = ((World) worldIn).canBlockSeeSky(pos.up());
- state = state.withProperty(SKY, Boolean.valueOf(seesSky));
- return state;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement