当前位置: 首页>>代码示例>>Java>>正文


Java EntityHanging.onValidSurface方法代码示例

本文整理汇总了Java中net.minecraft.entity.EntityHanging.onValidSurface方法的典型用法代码示例。如果您正苦于以下问题:Java EntityHanging.onValidSurface方法的具体用法?Java EntityHanging.onValidSurface怎么用?Java EntityHanging.onValidSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.EntityHanging的用法示例。


在下文中一共展示了EntityHanging.onValidSurface方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemUse

import net.minecraft.entity.EntityHanging; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (side == EnumFacing.DOWN)
    {
        return false;
    }
    else if (side == EnumFacing.UP)
    {
        return false;
    }
    else
    {
        BlockPos blockpos = pos.offset(side);

        if (!playerIn.canPlayerEdit(blockpos, side, stack))
        {
            return false;
        }
        else
        {
            EntityHanging entityhanging = this.createEntity(worldIn, blockpos, side);

            if (entityhanging != null && entityhanging.onValidSurface())
            {
                if (!worldIn.isRemote)
                {
                    worldIn.spawnEntityInWorld(entityhanging);
                }

                --stack.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:ItemHangingEntity.java

示例2: onItemUse

import net.minecraft.entity.EntityHanging; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    ItemStack itemstack = stack.getHeldItem(pos);
    BlockPos blockpos = worldIn.offset(hand);

    if (hand != EnumFacing.DOWN && hand != EnumFacing.UP && stack.canPlayerEdit(blockpos, hand, itemstack))
    {
        EntityHanging entityhanging = this.createEntity(playerIn, blockpos, hand);

        if (entityhanging != null && entityhanging.onValidSurface())
        {
            if (!playerIn.isRemote)
            {
                entityhanging.playPlaceSound();
                playerIn.spawnEntityInWorld(entityhanging);
            }

            itemstack.func_190918_g(1);
        }

        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:31,代码来源:ItemHangingEntity.java

示例3: onItemUse

import net.minecraft.entity.EntityHanging; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    BlockPos blockpos = pos.offset(facing);

    if (facing != EnumFacing.DOWN && facing != EnumFacing.UP && playerIn.canPlayerEdit(blockpos, facing, stack))
    {
        EntityHanging entityhanging = this.createEntity(worldIn, blockpos, facing);

        if (entityhanging != null && entityhanging.onValidSurface())
        {
            if (!worldIn.isRemote)
            {
                entityhanging.playPlaceSound();
                worldIn.spawnEntityInWorld(entityhanging);
            }

            --stack.stackSize;
        }

        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:ItemHangingEntity.java

示例4: onItemUse

import net.minecraft.entity.EntityHanging; //导入方法依赖的package包/类
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    ItemStack itemstack = player.getHeldItem(hand);
    BlockPos blockpos = pos.offset(facing);

    if (facing != EnumFacing.DOWN && facing != EnumFacing.UP && player.canPlayerEdit(blockpos, facing, itemstack))
    {
        EntityHanging entityhanging = this.createEntity(worldIn, blockpos, facing);

        if (entityhanging != null && entityhanging.onValidSurface())
        {
            if (!worldIn.isRemote)
            {
                entityhanging.playPlaceSound();
                worldIn.spawnEntity(entityhanging);
            }

            itemstack.shrink(1);
        }

        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:28,代码来源:ItemArtifactFrame.java

示例5: onItemUse

import net.minecraft.entity.EntityHanging; //导入方法依赖的package包/类
/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
    if (p_77648_7_ == 0)
    {
        return false;
    }
    else if (p_77648_7_ == 1)
    {
        return false;
    }
    else
    {
        int i1 = Direction.facingToDirection[p_77648_7_];
        EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1);

        if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_))
        {
            return false;
        }
        else
        {
            if (entityhanging != null && entityhanging.onValidSurface())
            {
                if (!p_77648_3_.isRemote)
                {
                    p_77648_3_.spawnEntityInWorld(entityhanging);
                }

                --p_77648_1_.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:jtrent238,项目名称:PopularMMOS-EpicProportions-Mod,代码行数:40,代码来源:ItemEpicProportionsPainting.java

示例6: onItemUse

import net.minecraft.entity.EntityHanging; //导入方法依赖的package包/类
/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
    if (par7 == 0)
    {
        return false;
    }
    else if (par7 == 1)
    {
        return false;
    }
    else
    {
        int var11 = Direction.facingToDirection[par7];
        EntityHanging var12 = this.createHangingEntity(par3World, par4, par5, par6, var11);

        if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
        {
            return false;
        }
        else
        {
            if (var12 != null && var12.onValidSurface())
            {
                if (!par3World.isClient)
                {
                    par3World.spawnEntityInWorld(var12);
                }

                --par1ItemStack.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:40,代码来源:ItemHangingEntity.java

示例7: onItemUse

import net.minecraft.entity.EntityHanging; //导入方法依赖的package包/类
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
    if (p_77648_7_ == 0)
    {
        return false;
    }
    else if (p_77648_7_ == 1)
    {
        return false;
    }
    else
    {
        int i1 = Direction.facingToDirection[p_77648_7_];
        EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1);

        if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_))
        {
            return false;
        }
        else
        {
            if (entityhanging != null && entityhanging.onValidSurface())
            {
                if (!p_77648_3_.isRemote)
                {
                    p_77648_3_.spawnEntityInWorld(entityhanging);
                }

                --p_77648_1_.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:36,代码来源:ItemHangingEntity.java

示例8: onItemUse

import net.minecraft.entity.EntityHanging; //导入方法依赖的package包/类
/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
    if (par7 == 0)
    {
        return false;
    }
    else if (par7 == 1)
    {
        return false;
    }
    else
    {
        int i1 = Direction.facingToDirection[par7];
        EntityHanging entityhanging = this.createHangingEntity(par3World, par4, par5, par6, i1);

        if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
        {
            return false;
        }
        else
        {
            if (entityhanging != null && entityhanging.onValidSurface())
            {
                if (!par3World.isRemote)
                {
                    par3World.spawnEntityInWorld(entityhanging);
                }

                --par1ItemStack.stackSize;
            }

            return true;
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:40,代码来源:ItemHangingEntity.java


注:本文中的net.minecraft.entity.EntityHanging.onValidSurface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。