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


Java BlockWallSign类代码示例

本文整理汇总了Java中net.minecraft.block.BlockWallSign的典型用法代码示例。如果您正苦于以下问题:Java BlockWallSign类的具体用法?Java BlockWallSign怎么用?Java BlockWallSign使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onItemUse

import net.minecraft.block.BlockWallSign; //导入依赖的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 (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid())
    {
        return false;
    }
    else
    {
        pos = pos.offset(side);

        if (!playerIn.canPlayerEdit(pos, side, stack))
        {
            return false;
        }
        else if (!Blocks.standing_sign.canPlaceBlockAt(worldIn, pos))
        {
            return false;
        }
        else if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            if (side == EnumFacing.UP)
            {
                int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
                worldIn.setBlockState(pos, Blocks.standing_sign.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
            }
            else
            {
                worldIn.setBlockState(pos, Blocks.wall_sign.getDefaultState().withProperty(BlockWallSign.FACING, side), 3);
            }

            --stack.stackSize;
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, playerIn, pos, stack))
            {
                playerIn.openEditSign((TileEntitySign)tileentity);
            }

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

示例2: onItemUse

import net.minecraft.block.BlockWallSign; //导入依赖的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 (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid())
    {
        return false;
    }
    else
    {
        pos = pos.offset(side);

        if (!playerIn.canPlayerEdit(pos, side, stack))
        {
            return false;
        }
        else if (!Blocks.standing_banner.canPlaceBlockAt(worldIn, pos))
        {
            return false;
        }
        else if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            if (side == EnumFacing.UP)
            {
                int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
                worldIn.setBlockState(pos, Blocks.standing_banner.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
            }
            else
            {
                worldIn.setBlockState(pos, Blocks.wall_banner.getDefaultState().withProperty(BlockWallSign.FACING, side), 3);
            }

            --stack.stackSize;
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityBanner)
            {
                ((TileEntityBanner)tileentity).setItemValues(stack);
            }

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

示例3: onItemUse

import net.minecraft.block.BlockWallSign; //导入依赖的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)
{
    IBlockState iblockstate = playerIn.getBlockState(worldIn);
    boolean flag = iblockstate.getBlock().isReplaceable(playerIn, worldIn);

    if (hand != EnumFacing.DOWN && (iblockstate.getMaterial().isSolid() || flag) && (!flag || hand == EnumFacing.UP))
    {
        worldIn = worldIn.offset(hand);
        ItemStack itemstack = stack.getHeldItem(pos);

        if (stack.canPlayerEdit(worldIn, hand, itemstack) && Blocks.STANDING_SIGN.canPlaceBlockAt(playerIn, worldIn))
        {
            if (playerIn.isRemote)
            {
                return EnumActionResult.SUCCESS;
            }
            else
            {
                worldIn = flag ? worldIn.down() : worldIn;

                if (hand == EnumFacing.UP)
                {
                    int i = MathHelper.floor((double)((stack.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
                    playerIn.setBlockState(worldIn, Blocks.STANDING_SIGN.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 11);
                }
                else
                {
                    playerIn.setBlockState(worldIn, Blocks.WALL_SIGN.getDefaultState().withProperty(BlockWallSign.FACING, hand), 11);
                }

                TileEntity tileentity = playerIn.getTileEntity(worldIn);

                if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(playerIn, stack, worldIn, itemstack))
                {
                    stack.openEditSign((TileEntitySign)tileentity);
                }

                itemstack.func_190918_g(1);
                return EnumActionResult.SUCCESS;
            }
        }
        else
        {
            return EnumActionResult.FAIL;
        }
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:ItemSign.java

示例4: onItemUse

import net.minecraft.block.BlockWallSign; //导入依赖的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)
{
    IBlockState iblockstate = playerIn.getBlockState(worldIn);
    boolean flag = iblockstate.getBlock().isReplaceable(playerIn, worldIn);

    if (hand != EnumFacing.DOWN && (iblockstate.getMaterial().isSolid() || flag) && (!flag || hand == EnumFacing.UP))
    {
        worldIn = worldIn.offset(hand);
        ItemStack itemstack = stack.getHeldItem(pos);

        if (stack.canPlayerEdit(worldIn, hand, itemstack) && Blocks.STANDING_BANNER.canPlaceBlockAt(playerIn, worldIn))
        {
            if (playerIn.isRemote)
            {
                return EnumActionResult.SUCCESS;
            }
            else
            {
                worldIn = flag ? worldIn.down() : worldIn;

                if (hand == EnumFacing.UP)
                {
                    int i = MathHelper.floor((double)((stack.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
                    playerIn.setBlockState(worldIn, Blocks.STANDING_BANNER.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
                }
                else
                {
                    playerIn.setBlockState(worldIn, Blocks.WALL_BANNER.getDefaultState().withProperty(BlockWallSign.FACING, hand), 3);
                }

                TileEntity tileentity = playerIn.getTileEntity(worldIn);

                if (tileentity instanceof TileEntityBanner)
                {
                    ((TileEntityBanner)tileentity).setItemValues(itemstack, false);
                }

                itemstack.func_190918_g(1);
                return EnumActionResult.SUCCESS;
            }
        }
        else
        {
            return EnumActionResult.FAIL;
        }
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:ItemBanner.java

示例5: onItemUse

import net.minecraft.block.BlockWallSign; //导入依赖的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)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    boolean flag = iblockstate.getBlock().isReplaceable(worldIn, pos);

    if (facing != EnumFacing.DOWN && (iblockstate.getMaterial().isSolid() || flag) && (!flag || facing == EnumFacing.UP))
    {
        pos = pos.offset(facing);

        if (playerIn.canPlayerEdit(pos, facing, stack) && Blocks.STANDING_SIGN.canPlaceBlockAt(worldIn, pos))
        {
            if (worldIn.isRemote)
            {
                return EnumActionResult.SUCCESS;
            }
            else
            {
                pos = flag ? pos.down() : pos;

                if (facing == EnumFacing.UP)
                {
                    int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
                    worldIn.setBlockState(pos, Blocks.STANDING_SIGN.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 11);
                }
                else
                {
                    worldIn.setBlockState(pos, Blocks.WALL_SIGN.getDefaultState().withProperty(BlockWallSign.FACING, facing), 11);
                }

                --stack.stackSize;
                TileEntity tileentity = worldIn.getTileEntity(pos);

                if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, playerIn, pos, stack))
                {
                    playerIn.openEditSign((TileEntitySign)tileentity);
                }

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

示例6: onItemUse

import net.minecraft.block.BlockWallSign; //导入依赖的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)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    boolean flag = iblockstate.getBlock().isReplaceable(worldIn, pos);

    if (facing != EnumFacing.DOWN && (iblockstate.getMaterial().isSolid() || flag) && (!flag || facing == EnumFacing.UP))
    {
        pos = pos.offset(facing);

        if (playerIn.canPlayerEdit(pos, facing, stack) && Blocks.STANDING_BANNER.canPlaceBlockAt(worldIn, pos))
        {
            if (worldIn.isRemote)
            {
                return EnumActionResult.SUCCESS;
            }
            else
            {
                pos = flag ? pos.down() : pos;

                if (facing == EnumFacing.UP)
                {
                    int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
                    worldIn.setBlockState(pos, Blocks.STANDING_BANNER.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
                }
                else
                {
                    worldIn.setBlockState(pos, Blocks.WALL_BANNER.getDefaultState().withProperty(BlockWallSign.FACING, facing), 3);
                }

                --stack.stackSize;
                TileEntity tileentity = worldIn.getTileEntity(pos);

                if (tileentity instanceof TileEntityBanner)
                {
                    ((TileEntityBanner)tileentity).setItemValues(stack);
                }

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

示例7: setTombstone

import net.minecraft.block.BlockWallSign; //导入依赖的package包/类
private void setTombstone() {
    // Check for solid ground if no wall exists
    boolean needsWall = !world.getBlockState(wallPos).getBlock().getMaterial().isSolid();
    BlockPos groundPos = wallPos.down();
    IBlockState groundState = world.getBlockState(groundPos);
    boolean isSolidGround = groundState.getBlock().getMaterial().isSolid();
    if (needsWall && !isSolidGround) {
        return;
    }

    // Find and take one sign
    boolean hasSign = false;
    if (BaMsConfig.needSignToMakeSign || isCreative) {
        for (int i = 0; i < inventory.getSizeInventory(); i++) {
            ItemStack stack = inventory.getStackInSlot(i);
            if (stack != null && stack.getItem() == Items.sign) {
                inventory.decrStackSize(i, 1);
                hasSign = true;
                break;
            }
        }
    } else {
        hasSign = true;
    }

    // Place wall if needed
    if (needsWall && !BaMsConfig.setTombstoneWall(world, wallPos, groundState, 2)) {
        // Place standing sign if wall can't be placed
        if (hasSign) {
            int oppositeRotation = oppositeFacing.getHorizontalIndex() * 4;
            BaMsConfig.setBlockState(world, wallPos, Blocks.standing_sign.getDefaultState().withProperty(BlockStandingSign.ROTATION, oppositeRotation), 2);
            addSignEngraving(wallPos);
        }
        return;
    }

    // Place wall sign
    if (hasSign) {
        BaMsConfig.setBlockState(world, signPos, Blocks.wall_sign.getDefaultState().withProperty(BlockWallSign.FACING, oppositeFacing), 2);
        addSignEngraving(signPos);
    }

    // Place flower pot
    BaMsConfig.setFlowerPot(world, flowerPotPos, 2);
}
 
开发者ID:MrIbby,项目名称:BaMsGRAVE,代码行数:46,代码来源:GraveDigger.java


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