Java Code Examples for net.minecraft.block.material.Material

The following are top voted examples for showing how to use net.minecraft.block.material.Material. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: minecraft-quiverbow   File: Helper.java   View source code 6 votes vote down vote up
public static boolean hasValidMaterial(World world, int x, int y, int z)
{
	Block block = world.getBlock(x, y, z);
	
	// Is the attached block a valid material?
	if (block.getMaterial() == Material.clay) { return true; }
	else if (block.getMaterial() == Material.cloth) { return true; }
	else if (block.getMaterial() == Material.grass) { return true; }
	else if (block.getMaterial() == Material.ground) { return true; }
	else if (block.getMaterial() == Material.iron) { return true; }
	else if (block.getMaterial() == Material.piston) { return true; }
	else if (block.getMaterial() == Material.rock) { return true; }
	else if (block.getMaterial() == Material.sand) { return true; }
	else if (block.getMaterial() == Material.wood) { return true; }
	else if (block.getMaterial() == Material.craftedSnow) { return true; }
	else if (block.getMaterial() == Material.leaves) { return true; }
	
	// No?
	return false;
}
 
Example 2
Project: Solar   File: ModBlocks.java   View source code 6 votes vote down vote up
public static void register(IForgeRegistry<Block> registry) {
	registry.register(new BlockBase(LibNames.PRIMAL_STONE, Material.ROCK).setHardness(4F).setResistance(2000F));
	registry.register(new BlockMonolithicGlyph());
	registry.register(new BlockQuantumMirror());
	registry.register(new BlockGravityHopper());
	registry.register(new BlockSchrodingerGlyph());
	registry.register(new BlockBlinker());
	registry.register(new BlockPhenomena());
	registry.register(new BlockQSquared());
	registry.register(new BlockTheorema());
	registry.register(new BlockGravityInhibitor());
	registry.register(new BlockHyperConductor());
	registry.register(new BlockElectron());
	registry.register(new BlockAshen());
	registry.register(new BlockMonolithic());
	registry.register(new BlockAngstrom());
	registry.register(new BlockQimranut());
	registry.register(new BlockCelestialResonator());
	registry.register(new BlockLargePot());
	registry.register(new BlockVacuumConveyor());
	registry.register(new BlockMechanicalTranslocator());
	registerTiles();
}
 
Example 3
Project: CustomWorldGen   File: EntityAIHarvestFarmland.java   View source code 6 votes vote down vote up
/**
 * Return true to set given position as destination
 */
protected boolean shouldMoveTo(World worldIn, BlockPos pos)
{
    Block block = worldIn.getBlockState(pos).getBlock();

    if (block == Blocks.FARMLAND)
    {
        pos = pos.up();
        IBlockState iblockstate = worldIn.getBlockState(pos);
        block = iblockstate.getBlock();

        if (block instanceof BlockCrops && ((BlockCrops)block).isMaxAge(iblockstate) && this.wantsToReapStuff && (this.currentTask == 0 || this.currentTask < 0))
        {
            this.currentTask = 0;
            return true;
        }

        if (iblockstate.getMaterial() == Material.AIR && this.hasFarmItem && (this.currentTask == 1 || this.currentTask < 0))
        {
            this.currentTask = 1;
            return true;
        }
    }

    return false;
}
 
Example 4
Project: connor41-etfuturum2   File: OceanMonument.java   View source code 6 votes vote down vote up
private static void generatePillar(World world, int x, int y, int z, Block block, int meta) {
	for (int i = 1; i <= 5; i++)
		generatePillarSection(world, x, y - i, z, block, meta);
	y -= 5;

	for (; y >= 0; y--) {
		generatePillarSection(world, x, y, z, block, meta);
		for (int i = 0; i < 4; i++)
			for (int k = 0; k < 4; k++)
				if (world.getBlock(x + i, y, z).getMaterial() != Material.water && y > 3) {
					generatePillarSection(world, x, y - 1, z, block, meta);
					generatePillarSection(world, x, y - 2, z, block, meta);
					return;
				}
	}
}
 
Example 5
Project: BaseClient   File: CommandSpreadPlayers.java   View source code 6 votes vote down vote up
public boolean func_111098_b(World worldIn)
{
    BlockPos blockpos = new BlockPos(this.field_111101_a, 256.0D, this.field_111100_b);

    while (blockpos.getY() > 0)
    {
        blockpos = blockpos.down();
        Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial();

        if (material != Material.air)
        {
            return !material.isLiquid() && material != Material.fire;
        }
    }

    return false;
}
 
Example 6
Project: CustomWorldGen   File: UniversalBucket.java   View source code 6 votes vote down vote up
@Deprecated
public boolean tryPlaceFluid(Block block, World worldIn, BlockPos pos)
{
    if (block instanceof IFluidBlock)
    {
        IFluidBlock fluidBlock = (IFluidBlock) block;
        return FluidUtil.tryPlaceFluid(null, worldIn, new FluidStack(fluidBlock.getFluid(), Fluid.BUCKET_VOLUME), pos);
    }
    else if (block.getDefaultState().getMaterial() == Material.WATER)
    {
        FluidUtil.tryPlaceFluid(null, worldIn, new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), pos);
    }
    else if (block.getDefaultState().getMaterial() == Material.LAVA)
    {
        FluidUtil.tryPlaceFluid(null, worldIn, new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME), pos);
    }
    return false;
}
 
Example 7
Project: DecompiledMinecraft   File: BlockStoneSlab.java   View source code 6 votes vote down vote up
public BlockStoneSlab()
{
    super(Material.rock);
    IBlockState iblockstate = this.blockState.getBaseState();

    if (this.isDouble())
    {
        iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf(false));
    }
    else
    {
        iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
    }

    this.setDefaultState(iblockstate.withProperty(VARIANT, BlockStoneSlab.EnumType.STONE));
    this.setCreativeTab(CreativeTabs.tabBlock);
}
 
Example 8
Project: statclock   File: ModBlocks.java   View source code 6 votes vote down vote up
public static void preInit() {

        // Ores
        sc_strangeOre = new BlockStrangeOre(Material.ROCK,"strange_ore");

        // Metal Blocks
        sc_strangeBlock = new BlockStrangeBlock(Material.IRON, "strange_block");
        sc_scrapBlock = new BlockScrapBlock(Material.IRON, "scrap_block");
        sc_reclaimedBlock = new BlockReclaimedBlock(Material.IRON, "reclaimed_block");
        sc_refinedBlock = new BlockRefinedBlock(Material.IRON, "refined_block");

        registerBlock(sc_strangeOre, "strange_ore");
        registerBlock(sc_strangeBlock, "strange_block");
        registerBlock(sc_scrapBlock, "scrap_block");
        registerBlock(sc_reclaimedBlock, "reclaimed_block");
        registerBlock(sc_refinedBlock, "refined_block");

    }
 
Example 9
Project: BetterBeginningsReborn   File: BlockCampfire.java   View source code 6 votes vote down vote up
public BlockCampfire(boolean lit)
{
    super(Material.WOOD);
    setResistance(3.0F);
    setHardness(0.5F);

    if (!lit)
    {
        setLightLevel(0.0f);
        setCreativeTab(ModMain.tabBetterBeginnings);
    }
    else
    {
        setLightLevel(0.875f);
    }

    isLit = lit;
}
 
Example 10
Project: Bewitchment   File: ExtinguishFiresBrew.java   View source code 6 votes vote down vote up
@Override
public void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
	if (side != null) pos = pos.offset(side);
	if (canExtinguish(world, pos, amplifier)) {
		int box = 1 + (int) ((float) amplifier / 2F);

		world.playSound(null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1F, 1F);

		BlockPos posI = pos.add(box, box, box);
		BlockPos posF = pos.add(-box, -box, -box);

		Iterable<BlockPos> poses = BlockPos.getAllInBox(posI, posF);
		poses.forEach(
				in -> {
					Material material = world.getBlockState(in).getMaterial();
					if (material == Material.FIRE) {
						world.setBlockToAir(in);
					}
				}
		);
	}
}
 
Example 11
Project: Loot-Slash-Conquer   File: BlockBase.java   View source code 5 votes vote down vote up
/**
 * Creates a block according to the following parameters.
 */
public BlockBase(Material material, String name, CreativeTabs tab, SoundType soundType, float hardness, float resistance, float lightValue, String harvestType, int harvestLevel)
{
	super(material);
	this.setRegistryName(Reference.MODID, name);
	this.setUnlocalizedName(name);
	this.setCreativeTab(tab);
	this.setSoundType(soundType);
	this.setHardness(hardness);
	this.setResistance(resistance);
	this.setLightLevel(lightValue);
	this.setHarvestLevel(harvestType, harvestLevel);
}
 
Example 12
Project: harshencastle   File: PedestalSlab.java   View source code 5 votes vote down vote up
public PedestalSlab() {
	super(Material.ROCK);
	setRegistryName("pedestal_slab");
	setUnlocalizedName("pedestal_slab");
	setHardness(5.0F);
	setResistance(5.0F);
}
 
Example 13
Project: BaseClient   File: BlockIce.java   View source code 5 votes vote down vote up
public BlockIce()
{
    super(Material.ice, false);
    this.slipperiness = 0.98F;
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.tabBlock);
}
 
Example 14
Project: BaseClient   File: Chunk.java   View source code 5 votes vote down vote up
public Chunk(World worldIn, ChunkPrimer primer, int x, int z)
{
    this(worldIn, x, z);
    int i = 256;
    boolean flag = !worldIn.provider.getHasNoSky();

    for (int j = 0; j < 16; ++j)
    {
        for (int k = 0; k < 16; ++k)
        {
            for (int l = 0; l < i; ++l)
            {
                int i1 = j * i * 16 | k * i | l;
                IBlockState iblockstate = primer.getBlockState(i1);

                if (iblockstate.getBlock().getMaterial() != Material.air)
                {
                    int j1 = l >> 4;

                    if (this.storageArrays[j1] == null)
                    {
                        this.storageArrays[j1] = new ExtendedBlockStorage(j1 << 4, flag);
                    }

                    this.storageArrays[j1].set(j, l & 15, k, iblockstate);
                }
            }
        }
    }
}
 
Example 15
Project: Technical   File: BlockHematiteBasalt2.java   View source code 5 votes vote down vote up
public BlockHematiteBasalt2() {
	super(Material.rock);
	setCreativeTab(Technical.tabTechnicalBlocks);
	setBlockName("hematiteBasalt2");
	setBlockTextureName(Technical.modName + ":" + getUnlocalizedName().substring(5));
	setStepSound(soundTypeStone);
	setHardness(5.0F);
	setResistance(5.0F);
	setHarvestLevel("pickaxe", 2);
}
 
Example 16
Project: Technical   File: BlockUrainiteGneiss.java   View source code 5 votes vote down vote up
public BlockUrainiteGneiss() {
	super(Material.rock);
	setCreativeTab(Technical.tabTechnicalBlocks);
	setBlockName("urainiteGneiss");
	setBlockTextureName(Technical.modName + ":" + getUnlocalizedName().substring(5));
	setStepSound(soundTypeStone);
	setHardness(6.0F);
	setResistance(6.0F);
	setHarvestLevel("pickaxe", 3);
}
 
Example 17
Project: BaseClient   File: BlockAnvil.java   View source code 5 votes vote down vote up
protected BlockAnvil()
{
    super(Material.anvil);
    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(DAMAGE, Integer.valueOf(0)));
    this.setLightOpacity(0);
    this.setCreativeTab(CreativeTabs.tabDecorations);
}
 
Example 18
Project: MC-More-Ore-Mod   File: BlockAluminiumOre.java   View source code 5 votes vote down vote up
public BlockAluminiumOre() {
	super(Material.IRON);

	setUnlocalizedName(ReferenceModBlocks.ALUMINIUMORE.getUnlocalizedName());
	setRegistryName(ReferenceModBlocks.ALUMINIUMORE.getRegistryName());
	
	setHardness(2.0F);
	setHarvestLevel("pickaxe", 1);
	setCreativeTab(ModTabs.ctDefault);
	
}
 
Example 19
Project: DecompiledMinecraft   File: EntityBoat.java   View source code 5 votes vote down vote up
protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos)
{
    if (onGroundIn)
    {
        if (this.fallDistance > 3.0F)
        {
            this.fall(this.fallDistance, 1.0F);

            if (!this.worldObj.isRemote && !this.isDead)
            {
                this.setDead();

                if (this.worldObj.getGameRules().getBoolean("doEntityDrops"))
                {
                    for (int i = 0; i < 3; ++i)
                    {
                        this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F);
                    }

                    for (int j = 0; j < 2; ++j)
                    {
                        this.dropItemWithOffset(Items.stick, 1, 0.0F);
                    }
                }
            }

            this.fallDistance = 0.0F;
        }
    }
    else if (this.worldObj.getBlockState((new BlockPos(this)).down()).getBlock().getMaterial() != Material.water && y < 0.0D)
    {
        this.fallDistance = (float)((double)this.fallDistance - y);
    }
}
 
Example 20
Project: harshencastle   File: BlockOfHeads.java   View source code 5 votes vote down vote up
public BlockOfHeads()
{
	super(Material.ROCK);
	setRegistryName("block_of_heads");
	setUnlocalizedName("block_of_heads");
	setHardness(5.0F);
	setResistance(5.0F);
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
 
Example 21
Project: Backmemed   File: BlockPressurePlate.java   View source code 5 votes vote down vote up
protected void playClickOnSound(World worldIn, BlockPos color)
{
    if (this.blockMaterial == Material.WOOD)
    {
        worldIn.playSound((EntityPlayer)null, color, SoundEvents.BLOCK_WOOD_PRESSPLATE_CLICK_ON, SoundCategory.BLOCKS, 0.3F, 0.8F);
    }
    else
    {
        worldIn.playSound((EntityPlayer)null, color, SoundEvents.BLOCK_STONE_PRESSPLATE_CLICK_ON, SoundCategory.BLOCKS, 0.3F, 0.6F);
    }
}
 
Example 22
Project: ExSartagine   File: BlockPot.java   View source code 5 votes vote down vote up
public BlockPot() {
	super(Material.ROCK);

	setLightLevel(0.0f);
	setHardness(8f);
	setSoundType(SoundType.STONE);
	setCreativeTab(ExSartagineItems.pots);
	setHarvestLevel("pickaxe", 1);
	setUnlocalizedName(ExSartagine.MODID+".pot");
	setRegistryName("pot");
	setHardness(3.5f);
	this.setLightOpacity(0);
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(FULL, false));

}
 
Example 23
Project: DecompiledMinecraft   File: BlockHopper.java   View source code 5 votes vote down vote up
public BlockHopper()
{
    super(Material.iron, MapColor.stoneColor);
    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.DOWN).withProperty(ENABLED, Boolean.valueOf(true)));
    this.setCreativeTab(CreativeTabs.tabRedstone);
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
 
Example 24
Project: DecompiledMinecraft   File: WorldGenTrees.java   View source code 5 votes vote down vote up
private void func_181650_b(World p_181650_1_, BlockPos p_181650_2_, PropertyBool p_181650_3_)
{
    this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_);
    int i = 4;

    for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i)
    {
        this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_);
        p_181650_2_ = p_181650_2_.down();
    }
}
 
Example 25
Project: CustomWorldGen   File: BlockSnow.java   View source code 5 votes vote down vote up
protected BlockSnow()
{
    super(Material.SNOW);
    this.setDefaultState(this.blockState.getBaseState().withProperty(LAYERS, Integer.valueOf(1)));
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.DECORATIONS);
}
 
Example 26
Project: BaseClient   File: BlockRedstoneLight.java   View source code 5 votes vote down vote up
public BlockRedstoneLight(boolean isOn)
{
    super(Material.redstoneLight);
    this.isOn = isOn;

    if (isOn)
    {
        this.setLightLevel(1.0F);
    }
}
 
Example 27
Project: Firma   File: LeafBlock2.java   View source code 5 votes vote down vote up
public LeafBlock2(Material materialIn) {
	super(materialIn, "leaf2");
	this.setHardness(10);
	this.setResistance(10);
	this.setCreativeTab(FirmaMod.blockTab);
	this.setDefaultState(this.getStateFromMeta(0));
	this.needsRandomTick=true;
}
 
Example 28
Project: DecompiledMinecraft   File: TileEntityNote.java   View source code 5 votes vote down vote up
public void triggerNote(World worldIn, BlockPos p_175108_2_)
{
    if (worldIn.getBlockState(p_175108_2_.up()).getBlock().getMaterial() == Material.air)
    {
        Material material = worldIn.getBlockState(p_175108_2_.down()).getBlock().getMaterial();
        int i = 0;

        if (material == Material.rock)
        {
            i = 1;
        }

        if (material == Material.sand)
        {
            i = 2;
        }

        if (material == Material.glass)
        {
            i = 3;
        }

        if (material == Material.wood)
        {
            i = 4;
        }

        worldIn.addBlockEvent(p_175108_2_, Blocks.noteblock, i, this.note);
    }
}
 
Example 29
Project: Backmemed   File: BlockFarmland.java   View source code 5 votes vote down vote up
protected BlockFarmland()
{
    super(Material.GROUND);
    this.setDefaultState(this.blockState.getBaseState().withProperty(MOISTURE, Integer.valueOf(0)));
    this.setTickRandomly(true);
    this.setLightOpacity(255);
}
 
Example 30
Project: CustomWorldGen   File: ItemFireball.java   View source code 5 votes vote down vote up
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return EnumActionResult.SUCCESS;
    }
    else
    {
        pos = pos.offset(facing);

        if (!playerIn.canPlayerEdit(pos, facing, stack))
        {
            return EnumActionResult.FAIL;
        }
        else
        {
            if (worldIn.getBlockState(pos).getMaterial() == Material.AIR)
            {
                worldIn.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, (itemRand.nextFloat() - itemRand.nextFloat()) * 0.2F + 1.0F);
                worldIn.setBlockState(pos, Blocks.FIRE.getDefaultState());
            }

            if (!playerIn.capabilities.isCreativeMode)
            {
                --stack.stackSize;
            }

            return EnumActionResult.SUCCESS;
        }
    }
}
 
Example 31
Project: CustomWorldGen   File: StructureComponent.java   View source code 5 votes vote down vote up
protected void randomlyRareFillWithBlocks(World worldIn, StructureBoundingBox boundingboxIn, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, IBlockState blockstateIn, boolean excludeAir)
{
    float f = (float)(maxX - minX + 1);
    float f1 = (float)(maxY - minY + 1);
    float f2 = (float)(maxZ - minZ + 1);
    float f3 = (float)minX + f / 2.0F;
    float f4 = (float)minZ + f2 / 2.0F;

    for (int i = minY; i <= maxY; ++i)
    {
        float f5 = (float)(i - minY) / f1;

        for (int j = minX; j <= maxX; ++j)
        {
            float f6 = ((float)j - f3) / (f * 0.5F);

            for (int k = minZ; k <= maxZ; ++k)
            {
                float f7 = ((float)k - f4) / (f2 * 0.5F);

                if (!excludeAir || this.getBlockStateFromPos(worldIn, j, i, k, boundingboxIn).getMaterial() != Material.AIR)
                {
                    float f8 = f6 * f6 + f5 * f5 + f7 * f7;

                    if (f8 <= 1.05F)
                    {
                        this.setBlockState(worldIn, blockstateIn, j, i, k, boundingboxIn);
                    }
                }
            }
        }
    }
}
 
Example 32
Project: minecraft-quiverbow   File: FenLight.java   View source code 5 votes vote down vote up
public FenLight(Material material) 
{
	super(material);
	this.setLightLevel(0.95F);	// Light, yo
	this.setHardness(0.2F);
	this.setResistance(10.0F);
	this.setStepSound(soundTypeGlass);
	this.setCreativeTab(CreativeTabs.tabDecorations);
	this.setBlockTextureName("glowstone");
	this.setBlockName("Fen Light");
	//this.setBlockBounds(sizeMin, sizeMin, sizeMin, sizeMax, sizeMax, sizeMax);
}
 
Example 33
Project: ExSartagine   File: BlockRange.java   View source code 5 votes vote down vote up
public BlockRange() {
	super(Material.IRON);

	setLightLevel(0.0f);
	setSoundType(SoundType.METAL);
	setCreativeTab(ExSartagineItems.pots);
	setHarvestLevel("pickaxe", 1);
	setUnlocalizedName(ExSartagine.MODID+".range");
	setRegistryName("range");
	setHardness(3.5f);
	this.setLightOpacity(0);
}
 
Example 34
Project: customstuff4   File: BlockSlab.java   View source code 5 votes vote down vote up
public BlockSlab(Material material, ContentBlockSlab content)
{
    super(material, MapColor.AIR); // that map color is being overridden

    this.content = content;
    mapper = StateMetaMapper.create(Collections.singleton(HALF));

    useNeighborBrightness = true;
}
 
Example 35
Project: DecompiledMinecraft   File: Chunk.java   View source code 5 votes vote down vote up
/**
 * Called once-per-chunk-per-tick, and advances the round-robin relight check index by up to 8 blocks at a time. In
 * a worst-case scenario, can potentially take up to 25.6 seconds, calculated via (4096/8)/20, to re-check all
 * blocks in a chunk, which may explain lagging light updates on initial world generation.
 */
public void enqueueRelightChecks()
{
    BlockPos blockpos = new BlockPos(this.xPosition << 4, 0, this.zPosition << 4);

    for (int i = 0; i < 8; ++i)
    {
        if (this.queuedLightChecks >= 4096)
        {
            return;
        }

        int j = this.queuedLightChecks % 16;
        int k = this.queuedLightChecks / 16 % 16;
        int l = this.queuedLightChecks / 256;
        ++this.queuedLightChecks;

        for (int i1 = 0; i1 < 16; ++i1)
        {
            BlockPos blockpos1 = blockpos.add(k, (j << 4) + i1, l);
            boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15;

            if (this.storageArrays[j] == null && flag || this.storageArrays[j] != null && this.storageArrays[j].getBlockByExtId(k, i1, l).getMaterial() == Material.air)
            {
                for (EnumFacing enumfacing : EnumFacing.values())
                {
                    BlockPos blockpos2 = blockpos1.offset(enumfacing);

                    if (this.worldObj.getBlockState(blockpos2).getBlock().getLightValue() > 0)
                    {
                        this.worldObj.checkLight(blockpos2);
                    }
                }

                this.worldObj.checkLight(blockpos1);
            }
        }
    }
}
 
Example 36
Project: Firma   File: ClayBlock.java   View source code 5 votes vote down vote up
public ClayBlock(Material materialIn) {
	super(materialIn, "clayBlock");
	this.setHardness(10);
	this.setResistance(10);
	this.setCreativeTab(FirmaMod.blockTab);
	this.setDefaultState(this.getStateFromMeta(0));
}
 
Example 37
Project: Backmemed   File: WorldGenReed.java   View source code 5 votes vote down vote up
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (int i = 0; i < 20; ++i)
    {
        BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), 0, rand.nextInt(4) - rand.nextInt(4));

        if (worldIn.isAirBlock(blockpos))
        {
            BlockPos blockpos1 = blockpos.down();

            if (worldIn.getBlockState(blockpos1.west()).getMaterial() == Material.WATER || worldIn.getBlockState(blockpos1.east()).getMaterial() == Material.WATER || worldIn.getBlockState(blockpos1.north()).getMaterial() == Material.WATER || worldIn.getBlockState(blockpos1.south()).getMaterial() == Material.WATER)
            {
                int j = 2 + rand.nextInt(rand.nextInt(3) + 1);

                for (int k = 0; k < j; ++k)
                {
                    if (Blocks.REEDS.canBlockStay(worldIn, blockpos))
                    {
                        worldIn.setBlockState(blockpos.up(k), Blocks.REEDS.getDefaultState(), 2);
                    }
                }
            }
        }
    }

    return true;
}
 
Example 38
Project: Backmemed   File: TileEntityFurnace.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack stack)
{
    if (stack.func_190926_b())
    {
        return 0;
    }
    else
    {
        Item item = stack.getItem();
        return item == Item.getItemFromBlock(Blocks.WOODEN_SLAB) ? 150 : (item == Item.getItemFromBlock(Blocks.WOOL) ? 100 : (item == Item.getItemFromBlock(Blocks.CARPET) ? 67 : (item == Item.getItemFromBlock(Blocks.LADDER) ? 300 : (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON) ? 100 : (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD ? 300 : (item == Item.getItemFromBlock(Blocks.COAL_BLOCK) ? 16000 : (item instanceof ItemTool && "WOOD".equals(((ItemTool)item).getToolMaterialName()) ? 200 : (item instanceof ItemSword && "WOOD".equals(((ItemSword)item).getToolMaterialName()) ? 200 : (item instanceof ItemHoe && "WOOD".equals(((ItemHoe)item).getMaterialName()) ? 200 : (item == Items.STICK ? 100 : (item != Items.BOW && item != Items.FISHING_ROD ? (item == Items.SIGN ? 200 : (item == Items.COAL ? 1600 : (item == Items.LAVA_BUCKET ? 20000 : (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL ? (item == Items.BLAZE_ROD ? 2400 : (item instanceof ItemDoor && item != Items.IRON_DOOR ? 200 : (item instanceof ItemBoat ? 400 : 0))) : 100)))) : 300)))))))))));
    }
}
 
Example 39
Project: Firma   File: PlankBlock2.java   View source code 5 votes vote down vote up
public PlankBlock2(Material materialIn) {
	super(materialIn, "plank2");
	this.setHardness(10);
	this.setResistance(10);
	this.setCreativeTab(FirmaMod.blockTab);
	this.setDefaultState(this.getStateFromMeta(0));
}
 
Example 40
Project: DecompiledMinecraft   File: WorldGenSwamp.java   View source code 5 votes vote down vote up
private void func_181647_a(World p_181647_1_, BlockPos p_181647_2_, PropertyBool p_181647_3_)
{
    IBlockState iblockstate = Blocks.vine.getDefaultState().withProperty(p_181647_3_, Boolean.valueOf(true));
    this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate);
    int i = 4;

    for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i)
    {
        this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate);
        p_181647_2_ = p_181647_2_.down();
    }
}