package micdoodle8.mods.galacticraft.core.blocks; import java.util.Random; import micdoodle8.mods.galacticraft.core.GCBlocks; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockRedstoneRepeater; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockConcealedRepeater extends BlockRedstoneRepeater implements ISortableBlock { public BlockConcealedRepeater(String assetName, boolean powered) { super(powered); this.setHardness(1.0F); this.setStepSound(Block.soundTypeMetal); this.blockResistance = 15F; this.setUnlocalizedName(assetName); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); this.setCreativeTab(powered ? null : GalacticraftCore.galacticraftBlocksTab); } @Override public EnumSortCategoryBlock getCategory(int meta) { return EnumSortCategoryBlock.DECORATION; } @Override public int getLightOpacity() { return 0; } @Override public boolean isOpaqueCube() { return true; } @Override public boolean isFullCube() { return true; } @Override public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) { return true; } @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { return true; } @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); } @Override public boolean canBlockStay(World worldIn, BlockPos pos) { return true; } @Override protected IBlockState getPoweredState(IBlockState unpoweredState) { Integer integer = (Integer)unpoweredState.getValue(DELAY); Boolean obool = (Boolean)unpoweredState.getValue(LOCKED); EnumFacing enumfacing = (EnumFacing)unpoweredState.getValue(FACING); return GCBlocks.concealedRepeater_Powered.getDefaultState().withProperty(FACING, enumfacing).withProperty(DELAY, integer).withProperty(LOCKED, obool); } @Override protected IBlockState getUnpoweredState(IBlockState poweredState) { Integer integer = (Integer)poweredState.getValue(DELAY); Boolean obool = (Boolean)poweredState.getValue(LOCKED); EnumFacing enumfacing = (EnumFacing)poweredState.getValue(FACING); return GCBlocks.concealedRepeater_Unpowered.getDefaultState().withProperty(FACING, enumfacing).withProperty(DELAY, integer).withProperty(LOCKED, obool); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return ItemBlock.getItemFromBlock(GCBlocks.concealedRepeater_Unpowered); } @Override @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return ItemBlock.getItemFromBlock(GCBlocks.concealedRepeater_Unpowered); } @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { } }