當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。