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


Java BlockFalling.func_149831_e方法代碼示例

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


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

示例1: tryToFall

import net.minecraft.block.BlockFalling; //導入方法依賴的package包/類
/**
 * If there is space to fall below will start this block falling
 */
private void tryToFall(World par1World, int par2, int par3, int par4)
{
    if (BlockFalling.func_149831_e(par1World, par2, par3 - 1, par4) && par3 >= 0)
    {
        byte var8 = 32;

        if (!BlockFalling.fallInstantly && par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8))
        {
            if (!par1World.isRemote)
            {
            	EntityFallingBlock var9 = new EntityFallingBlock(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this, par1World.getBlockMetadata(par2, par3, par4));
                par1World.spawnEntityInWorld(var9);
            }
        }
        else
        {
            par1World.setBlockToAir(par2, par3, par4);

            while (BlockFalling.func_149831_e(par1World, par2, par3 - 1, par4) && par3 > 0)
            {
                --par3;
            }

            if (par3 > 0)
            {
                par1World.setBlock(par2, par3, par4, this);
            }
        }
    }
}
 
開發者ID:lawremi,項目名稱:PerFabricaAdAstra,代碼行數:34,代碼來源:LooseGeoBlock.java

示例2: onUpdate

import net.minecraft.block.BlockFalling; //導入方法依賴的package包/類
@Override
public void onUpdate() {
	if(block != null && block.getMaterial() == Material.air) {
		setDead();
	} else {
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;
		time++;
		motionY -= 0.03999999910593033D;
		moveEntity(motionX, motionY, motionZ);
		motionX *= 0.9800000190734863D;
		motionY *= 0.9800000190734863D;
		motionZ *= 0.9800000190734863D;
		if(!worldObj.isRemote) {
			int x = MathHelper.floor_double(posX);
			int y = MathHelper.floor_double(posY);
			int z = MathHelper.floor_double(posZ);
			if(time == 1) {
				if(worldObj.getBlock(x, y, z) != block) {
					setDead();
					return;
				}
				worldObj.setBlockToAir(x, y, z);
			}
			if(onGround) {
				motionX *= 0.699999988079071D;
				motionZ *= 0.699999988079071D;
				motionY *= -0.5D;
				if(worldObj.getBlock(x, y, z) != Blocks.piston_extension) {
					setDead();
					if(!broken && worldObj.canPlaceEntityOnSide(block, x, y, z, true, 1, (Entity) null, (ItemStack) null) && !BlockFalling.func_149831_e(worldObj, x, y - 1, z) && worldObj.setBlock(x, y, z, block, meta, 3)) {
						if(block instanceof BlockFalling) {
							((BlockFalling) block).func_149828_a(worldObj, x, y, z, meta);
						} else if(block instanceof IBlockFalling) {
							((IBlockFalling) block).onFallEnded(worldObj, x, y, z, meta);
						}
						if(tileEntityData != null && block instanceof ITileEntityProvider) {
							TileEntity tile = worldObj.getTileEntity(x, y, z);
							if(tile != null) {
								NBTTagCompound nbt = new NBTTagCompound();
								tile.writeToNBT(nbt);
								Iterator iterator = tileEntityData.func_150296_c().iterator();
								while(iterator.hasNext()) {
									String s = (String) iterator.next();
									NBTBase tag = tileEntityData.getTag(s);
									if(!s.equals("x") && !s.equals("y") && !s.equals("z")) {
										nbt.setTag(s, tag.copy());
									}
								}
								tile.readFromNBT(nbt);
								tile.markDirty();
							}
						}
					} else if(dropItem && !broken) {
						entityDropItem(new ItemStack(block, 1, block.damageDropped(meta)), 0.0F);
					}
				}
			} else if(time > 100 && !worldObj.isRemote && (y < 1 || y > 256) || time > 600) {
				if(dropItem) {
					entityDropItem(new ItemStack(block, 1, block.damageDropped(meta)), 0.0F);
				}
				setDead();
			}
		}
	}
}
 
開發者ID:AgeCraft,項目名稱:AgeCraft-Old,代碼行數:68,代碼來源:EntityFallingBlock.java


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