當前位置: 首頁>>代碼示例>>Java>>正文


Java Material.snow方法代碼示例

本文整理匯總了Java中net.minecraft.block.material.Material.snow方法的典型用法代碼示例。如果您正苦於以下問題:Java Material.snow方法的具體用法?Java Material.snow怎麽用?Java Material.snow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.block.material.Material的用法示例。


在下文中一共展示了Material.snow方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BlockSnow

import net.minecraft.block.material.Material; //導入方法依賴的package包/類
protected BlockSnow()
{
    super(Material.snow);
    this.setDefaultState(this.blockState.getBaseState().withProperty(LAYERS, Integer.valueOf(1)));
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.tabDecorations);
    this.setBlockBoundsForItemRender();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:10,代碼來源:BlockSnow.java

示例2: 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.snow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。