当前位置: 首页>>代码示例>>Java>>正文


Java Material类代码示例

本文整理汇总了Java中net.minecraft.block.material.Material的典型用法代码示例。如果您正苦于以下问题:Java Material类的具体用法?Java Material怎么用?Java Material使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Material类属于net.minecraft.block.material包,在下文中一共展示了Material类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasValidMaterial

import net.minecraft.block.material.Material; //导入依赖的package包/类
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;
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:21,代码来源:Helper.java

示例2: register

import net.minecraft.block.material.Material; //导入依赖的package包/类
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();
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:24,代码来源:ModBlocks.java

示例3: shouldMoveTo

import net.minecraft.block.material.Material; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:EntityAIHarvestFarmland.java

示例4: generatePillar

import net.minecraft.block.material.Material; //导入依赖的package包/类
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;
				}
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:17,代码来源:OceanMonument.java

示例5: func_111098_b

import net.minecraft.block.material.Material; //导入依赖的package包/类
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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:CommandSpreadPlayers.java

示例6: tryPlaceFluid

import net.minecraft.block.material.Material; //导入依赖的package包/类
@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;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:UniversalBucket.java

示例7: BlockStoneSlab

import net.minecraft.block.material.Material; //导入依赖的package包/类
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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:BlockStoneSlab.java

示例8: preInit

import net.minecraft.block.material.Material; //导入依赖的package包/类
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");

    }
 
开发者ID:lucidagrande,项目名称:statclock,代码行数:19,代码来源:ModBlocks.java

示例9: BlockCampfire

import net.minecraft.block.material.Material; //导入依赖的package包/类
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;
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:19,代码来源:BlockCampfire.java

示例10: safeImpact

import net.minecraft.block.material.Material; //导入依赖的package包/类
@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);
					}
				}
		);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:23,代码来源:ExtinguishFiresBrew.java

示例11: BlockBase

import net.minecraft.block.material.Material; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:16,代码来源:BlockBase.java

示例12: PedestalSlab

import net.minecraft.block.material.Material; //导入依赖的package包/类
public PedestalSlab() {
	super(Material.ROCK);
	setRegistryName("pedestal_slab");
	setUnlocalizedName("pedestal_slab");
	setHardness(5.0F);
	setResistance(5.0F);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:8,代码来源:PedestalSlab.java

示例13: BlockIce

import net.minecraft.block.material.Material; //导入依赖的package包/类
public BlockIce()
{
    super(Material.ice, false);
    this.slipperiness = 0.98F;
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.tabBlock);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:8,代码来源:BlockIce.java

示例14: Chunk

import net.minecraft.block.material.Material; //导入依赖的package包/类
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);
                }
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:31,代码来源:Chunk.java

示例15: BlockHematiteBasalt2

import net.minecraft.block.material.Material; //导入依赖的package包/类
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);
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:11,代码来源:BlockHematiteBasalt2.java


注:本文中的net.minecraft.block.material.Material类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。