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


Java Material.grass方法代码示例

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


在下文中一共展示了Material.grass方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: BlockMycelium

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
protected BlockMycelium()
{
    super(Material.grass, MapColor.purpleColor);
    this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.tabBlock);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:BlockMycelium.java

示例3: BlockGrass

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
protected BlockGrass()
{
    super(Material.grass);
    this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.tabBlock);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:BlockGrass.java

示例4: GrassPath

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public GrassPath() {
	super(Material.grass);
	setHardness(0.6F);
	setLightOpacity(255);
	setHarvestLevel("shovel", 0);
	useNeighborBrightness = true;
	setStepSound(soundTypeGrass);
	setBlockTextureName("grass_path");
	setBlockName(Utils.getUnlocalisedName("grass_path"));
	setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
	setCreativeTab(EtFuturum.enableGrassPath ? EtFuturum.creativeTab : null);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:13,代码来源:GrassPath.java

示例5: BlockHay

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public BlockHay()
{
    super(Material.grass, MapColor.yellowColor);
    this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.Y));
    this.setCreativeTab(CreativeTabs.tabBlock);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:7,代码来源:BlockHay.java

示例6: onImpact

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
@Override
public void onImpact(MovingObjectPosition target)
{
	if (target.entityHit != null) // hit a entity
   	{
   		target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (float) 0);	// No dmg, but knockback
           target.entityHit.hurtResistantTime = 0;
           target.entityHit.setFire(fireDuration); 	// Some minor fire, for flavor
   	}
   	else // hit the terrain
       {        	
       	int plusX = 0;
   		int plusY = 0;
   		int plusZ = 0;
   		
   		int posiX = target.blockX;
   		int posiY = target.blockY;
   		int posiZ = target.blockZ;

   		//Block targetBlock = this.worldObj.getBlock(posiX, posiY, posiZ);
   		
   		// Is the attached block a valid material?
   		boolean canPlace = false;
   		if ( Helper.hasValidMaterial(this.worldObj, posiX, posiY, posiZ) ) { canPlace = true; }
   		
       	// Glass breaking
           if ( Helper.tryBlockBreak(this.worldObj, this, target, 0)) { canPlace = false; }
   		
   		if (target.sideHit == 0) { plusY = -1; } 		// Bottom		
   		else if (target.sideHit == 1) { plusY = 1; } 	// Top
   		else if (target.sideHit == 2) { plusZ = -1; } 	// East
   		else if (target.sideHit == 3){ plusZ = 1; } 	// West
   		else if (target.sideHit == 4){ plusX = -1; } 	// North
   		else if (target.sideHit == 5) { plusX = 1; } 	// South
   		
   		// Is the space free?
   		if (this.worldObj.getBlock( (int)posiX + plusX, (int)posiY + plusY, (int)posiZ + plusZ).getMaterial() == Material.air ||
   				this.worldObj.getBlock( (int)posiX + plusX, (int)posiY + plusY, (int)posiZ + plusZ).getMaterial() == Material.fire ||
   				this.worldObj.getBlock( (int)posiX + plusX, (int)posiY + plusY, (int)posiZ + plusZ).getMaterial() == Material.grass ||
   				this.worldObj.getBlock( (int)posiX + plusX, (int)posiY + plusY, (int)posiZ + plusZ).getMaterial() == Material.snow ||
   				this.worldObj.getBlock( (int)posiX + plusX, (int)posiY + plusY, (int)posiZ + plusZ).getMaterial() == Material.water)
       	{
   			// Putting light there (if we can)
   			if (canPlace)
   			{
    			this.worldObj.setBlock(posiX + plusX, posiY + plusY, posiZ + plusZ, Main.fenLight, 0, 3);
    			this.worldObj.setBlockMetadataWithNotify(posiX + plusX, posiY + plusY, posiZ + plusZ, target.sideHit, 3);
    			
    			if (this.lightTick != 0) 
    			{ 
    				this.worldObj.scheduleBlockUpdate(posiX + plusX, posiY + plusY, posiZ + plusZ, Main.fenLight, this.lightTick); 
    			}
    			// else, stays on indefinitely
   			}
   			// else, can't place. The block isn't of a valid material
       	}
   		// else, none of the allowed materials
       }
   	
   	// SFX
   	for (int i = 0; i < 8; ++i) { this.worldObj.spawnParticle("slime", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); }
       this.worldObj.playSoundAtEntity(this, Block.soundTypeGlass.getBreakSound(), 1.0F, 1.0F);
       
       this.setDead();		// We've hit something, so begone with the projectile
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:66,代码来源:FenGoop.java


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