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


Java World.func_147453_f方法代碼示例

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


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

示例1: breakBlock

import net.minecraft.world.World; //導入方法依賴的package包/類
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
	if (!isBurning) {
		TileEntityMachine tileEntity = (TileEntityMachine) world.getTileEntity(x, y, z);
		if (tileEntity != null) {
			for (int i = 0; i < tileEntity.getSizeInventory(); ++i) {
				ItemStack itemStack = tileEntity.getStackInSlot(i);

				if (itemStack != null) {
					float f0 = random.nextFloat() * 0.8F + 0.1F;
					float f1 = random.nextFloat() * 0.8F + 0.1F;
					float f2 = random.nextFloat() * 0.8F + 0.1F;

					while (itemStack.stackSize > 0) {
						int j = random.nextInt(21) + 10;

						if (j > itemStack.stackSize)
							j = itemStack.stackSize;

						itemStack.stackSize -= j;

						EntityItem entityItem = new EntityItem(world, (double) ((float) x + f1), (double) ((float) y + f0), (double) ((float) z + f2), new ItemStack(itemStack.getItem(), j));

						if (itemStack.hasTagCompound())
							entityItem.getEntityItem().setTagCompound(((NBTTagCompound) itemStack.getTagCompound().copy()));

						float f3 = 0.025F;
						entityItem.motionX = (double) ((float) random.nextGaussian() * f3);
						entityItem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.1F);
						entityItem.motionZ = (double) ((float) random.nextGaussian() * f3);
						world.spawnEntityInWorld(entityItem);
					}
				}
			}
			world.func_147453_f(x, y, z, block);
		}
	}
	super.breakBlock(world, x, y, z, block, meta);
}
 
開發者ID:viddeno,項目名稱:Technical,代碼行數:39,代碼來源:Machine.java

示例2: breakBlock

import net.minecraft.world.World; //導入方法依賴的package包/類
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
	TileEntityAuto tileEntity = (TileEntityAuto) world.getTileEntity(x, y, z);
	if(tileEntity != null) {
		for(int i = 0; i < tileEntity.getSizeInventory(); ++i) {
			ItemStack itemStack = tileEntity.getStackInSlot(i);

			if(itemStack != null) {
				float f0 = random.nextFloat() * 0.8F + 0.1F;
				float f1 = random.nextFloat() * 0.8F + 0.1F;
				float f2 = random.nextFloat() * 0.8F + 0.1F;

				while(itemStack.stackSize > 0) {
					int j = random.nextInt(21) + 10;

					if(j > itemStack.stackSize)
						j = itemStack.stackSize;

					itemStack.stackSize -= j;

					EntityItem entityItem = new EntityItem(world, (double) ((float) x + f1), (double) ((float) y + f0), (double) ((float) z + f2), new ItemStack(itemStack.getItem(), j));

					if(itemStack.hasTagCompound())
						entityItem.getEntityItem().setTagCompound(((NBTTagCompound) itemStack.getTagCompound().copy()));

					float f3 = 0.025F;
					entityItem.motionX = (double) ((float) random.nextGaussian() * f3);
					entityItem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.1F);
					entityItem.motionZ = (double) ((float) random.nextGaussian() * f3);
					world.spawnEntityInWorld(entityItem);
				}
			}
		}
		world.func_147453_f(x, y, z, block);
	}
	super.breakBlock(world, x, y, z, block, meta);
}
 
開發者ID:viddeno,項目名稱:Technical,代碼行數:37,代碼來源:Auto.java

示例3: breakBlockWithInventory

import net.minecraft.world.World; //導入方法依賴的package包/類
default void breakBlockWithInventory(World world, int x, int y, int z, Block oldblock, int oldMetadata)
{
    if(!keepInventory)
    {
        TileKTWithInventory tileentity = (TileKTWithInventory) world.getTileEntity(x, y, z);

        if(tileentity != null)
        {
            for(int i = 0; i < tileentity.getSizeInventory(); i++)
            {
                ItemStack itemstack = tileentity.getStackInSlot(i);

                if(itemstack != null)
                {
                    float f = this.rand.nextFloat() * 0.8F + 0.1F;
                    float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
                    float f2 = this.rand.nextFloat() * 0.8F + 0.1F;

                    while(itemstack.stackSize > 0)
                    {
                        int j = this.rand.nextInt(21) + 10;

                        if(j > itemstack.stackSize)
                            j = itemstack.stackSize;

                        itemstack.stackSize -= j;

                        EntityItem item = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));

                        if(itemstack.hasTagCompound())
                            item.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());

                        world.spawnEntityInWorld(item);
                    }
                }
            }
            //Maybe this fucntion is about to replace block without meta data
            world.func_147453_f(x, y, z, oldblock);
        }
    }
    else
    {
        //some code to keep inventory
    }
}
 
開發者ID:koravel,項目名稱:ElementalElaboration,代碼行數:46,代碼來源:IBlockWithInventory.java


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