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


Java ItemDoor.placeDoor方法代码示例

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


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

示例1: placeDoorCurrentPosition

import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
/**
 * Places door on given position
 */
protected void placeDoorCurrentPosition(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, EnumFacing facing)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos))
    {
        ItemDoor.placeDoor(worldIn, blockpos, facing.rotateYCCW(), Blocks.oak_door);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:StructureComponent.java

示例2: onItemUse

import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (side != EnumFacing.UP)
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();

        if (!block.isReplaceable(worldIn, pos))
        {
            pos = pos.offset(side);
        }

        if (!playerIn.canPlayerEdit(pos, side, stack))
        {
            return false;
        }
        else if (!this.block.canPlaceBlockAt(worldIn, pos))
        {
            return false;
        }
        else
        {
            ItemDoor.placeDoor(worldIn, pos, EnumFacing.fromAngle((double)playerIn.rotationYaw), this.block);
            --stack.stackSize;
            return true;
        }
    }
}
 
开发者ID:dags-,项目名称:CreativeBlock,代码行数:34,代码来源:CBItemDoor.java

示例3: put

import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
protected void put(BlockPos pos, IBlockState block_state, EnumFacing facing) {
    // don't run on client
    if (this.world == null || this.world.isRemote) return;

    Block block = block_state.getBlock();

    FMLLog.info("Putting %s at %s", block_state, pos);

    // handle special cases
    if (block instanceof BlockDoor) {
        ItemDoor.placeDoor(this.world, pos, facing, block, true);
    } else if (block instanceof BlockBed) {
        BlockPos headpos = pos.offset(facing);
        if (this.world.getBlockState(pos.down()).isSideSolid(this.world, pos.down(), EnumFacing.UP) &&
                this.world.getBlockState(headpos.down()).isSideSolid(this.world, headpos.down(), EnumFacing.UP)) {
            block_state = block_state
                    .withProperty(BlockBed.OCCUPIED, false).withProperty(BlockBed.FACING, facing)
                    .withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);
            if (this.world.setBlockState(pos, block_state, 11)) {
                block_state = block_state.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD);
                this.world.setBlockState(headpos, block_state, 11);
            }
        }
    } else {
        this.world.setBlockState(pos, block_state);
    }
}
 
开发者ID:r1chardj0n3s,项目名称:pycode-minecraft,代码行数:28,代码来源:BaseMethods.java


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