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


Java ItemStack.canPlaceOn方法代碼示例

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


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

示例1: canPlayerEdit

import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
public boolean canPlayerEdit(BlockPos p_175151_1_, EnumFacing p_175151_2_, ItemStack p_175151_3_)
{
    if (this.capabilities.allowEdit)
    {
        return true;
    }
    else if (p_175151_3_ == null)
    {
        return false;
    }
    else
    {
        BlockPos blockpos = p_175151_1_.offset(p_175151_2_.getOpposite());
        Block block = this.worldObj.getBlockState(blockpos).getBlock();
        return p_175151_3_.canPlaceOn(block) || p_175151_3_.canEditBlocks();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:18,代碼來源:EntityPlayer.java

示例2: canPlayerEdit

import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
public boolean canPlayerEdit(BlockPos pos, EnumFacing facing, ItemStack stack)
{
    if (this.capabilities.allowEdit)
    {
        return true;
    }
    else if (stack.func_190926_b())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = pos.offset(facing.getOpposite());
        Block block = this.world.getBlockState(blockpos).getBlock();
        return stack.canPlaceOn(block) || stack.canEditBlocks();
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:18,代碼來源:EntityPlayer.java

示例3: canPlayerEdit

import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
public boolean canPlayerEdit(BlockPos pos, EnumFacing facing, @Nullable ItemStack stack)
{
    if (this.capabilities.allowEdit)
    {
        return true;
    }
    else if (stack == null)
    {
        return false;
    }
    else
    {
        BlockPos blockpos = pos.offset(facing.getOpposite());
        Block block = this.worldObj.getBlockState(blockpos).getBlock();
        return stack.canPlaceOn(block) || stack.canEditBlocks();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:EntityPlayer.java

示例4: isDrawBlockOutline

import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
private boolean isDrawBlockOutline()
{
    if (!this.drawBlockOutline)
    {
        return false;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;

        if (flag && !((EntityPlayer)entity).capabilities.allowEdit)
        {
            ItemStack itemstack = ((EntityPlayer)entity).getCurrentEquippedItem();

            if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
            {
                BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
                Block block = this.mc.theWorld.getBlockState(blockpos).getBlock();

                if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR)
                {
                    flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
                }
                else
                {
                    flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
                }
            }
        }

        return flag;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:35,代碼來源:EntityRenderer.java

示例5: isDrawBlockOutline

import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
private boolean isDrawBlockOutline()
{
    if (!this.drawBlockOutline)
    {
        return false;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;

        if (flag && !((EntityPlayer)entity).capabilities.allowEdit)
        {
            ItemStack itemstack = ((EntityPlayer)entity).getCurrentEquippedItem();

            if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
            {
                BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
                IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);
                Block block = iblockstate.getBlock();

                if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR)
                {
                    flag = ReflectorForge.blockHasTileEntity(iblockstate) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
                }
                else
                {
                    flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
                }
            }
        }

        return flag;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:36,代碼來源:EntityRenderer.java

示例6: isDrawBlockOutline

import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
private boolean isDrawBlockOutline() {
	if (!this.drawBlockOutline) {
		return false;
	} else {
		Entity entity = this.mc.getRenderViewEntity();
		boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;

		if (flag && !((EntityPlayer) entity).capabilities.allowEdit) {
			ItemStack itemstack = ((EntityPlayer) entity).getCurrentEquippedItem();

			if (this.mc.objectMouseOver != null
					&& this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
				BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
				Block block = this.mc.theWorld.getBlockState(blockpos).getBlock();

				if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) {
					boolean flag1;

					if (Reflector.ForgeBlock_hasTileEntity.exists()) {
						IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);
						flag1 = Reflector.callBoolean(block, Reflector.ForgeBlock_hasTileEntity,
								new Object[] { iblockstate });
					} else {
						flag1 = block.hasTileEntity();
					}

					flag = flag1 && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
				} else {
					flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
				}
			}
		}

		return flag;
	}
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:37,代碼來源:EntityRenderer.java

示例7: isDrawBlockOutline

import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
private boolean isDrawBlockOutline()
{
    if (!this.drawBlockOutline)
    {
        return false;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;

        if (flag && !((EntityPlayer)entity).capabilities.allowEdit)
        {
            ItemStack itemstack = ((EntityPlayer)entity).getHeldItemMainhand();

            if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
            {
                BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
                IBlockState iblockstate = this.mc.world.getBlockState(blockpos);
                Block block = iblockstate.getBlock();

                if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
                {
                    flag = ReflectorForge.blockHasTileEntity(iblockstate) && this.mc.world.getTileEntity(blockpos) instanceof IInventory;
                }
                else
                {
                    flag = !itemstack.func_190926_b() && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
                }
            }
        }

        return flag;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:36,代碼來源:EntityRenderer.java

示例8: isDrawBlockOutline

import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
private boolean isDrawBlockOutline()
{
    if (!this.drawBlockOutline)
    {
        return false;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;

        if (flag && !((EntityPlayer)entity).capabilities.allowEdit)
        {
            ItemStack itemstack = ((EntityPlayer)entity).getHeldItemMainhand();

            if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
            {
                BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
                Block block = this.mc.theWorld.getBlockState(blockpos).getBlock();

                if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
                {
                    flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
                }
                else
                {
                    flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
                }
            }
        }

        return flag;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:35,代碼來源:EntityRenderer.java


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