本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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);
}
示例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");
}
示例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;
}
示例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);
}
}
);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
}
}
示例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);
}