本文整理汇总了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);
}
}
示例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;
}
}
}
示例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);
}
}