当前位置: 首页>>代码示例>>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;未经允许,请勿转载。