本文整理汇总了Java中net.minecraft.block.Block.isBed方法的典型用法代码示例。如果您正苦于以下问题:Java Block.isBed方法的具体用法?Java Block.isBed怎么用?Java Block.isBed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.isBed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBedSpawnLocation
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Return null if bed is invalid
*/
@Nullable
public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn)
{
IBlockState state = worldIn.getBlockState(bedLocation);
Block block = state.getBlock();
if (!block.isBed(state, worldIn, bedLocation, null))
{
if (!forceSpawn)
{
return null;
}
else
{
boolean flag = block.canSpawnInBlock();
boolean flag1 = worldIn.getBlockState(bedLocation.up()).getBlock().canSpawnInBlock();
return flag && flag1 ? bedLocation : null;
}
}
else
{
return block.getBedSpawnPosition(state, worldIn, bedLocation, null);
}
}
示例2: orientBedCamera
import net.minecraft.block.Block; //导入方法依赖的package包/类
public static void orientBedCamera(IBlockAccess world, BlockPos pos, IBlockState state, Entity entity)
{
Block block = state.getBlock();
if (block != null && block.isBed(state, world, pos, entity))
{
glRotatef((float)(block.getBedDirection(state, world, pos).getHorizontalIndex() * 90), 0.0F, 1.0F, 0.0F);
}
}
示例3: cacheActiveRenderInfo
import net.minecraft.block.Block; //导入方法依赖的package包/类
public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks)
{
this.worldObj = worldIn;
this.options = optionsIn;
this.renderViewEntity = livingPlayerIn;
this.pointedEntity = pointedEntityIn;
this.textRenderer = textRendererIn;
if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase)livingPlayerIn).isPlayerSleeping())
{
IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn));
Block block = iblockstate.getBlock();
if (block.isBed(iblockstate, worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn))
{
int i = block.getBedDirection(iblockstate, worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex();
this.playerViewY = (float)(i * 90 + 180);
this.playerViewX = 0.0F;
}
}
else
{
this.playerViewY = livingPlayerIn.prevRotationYaw + (livingPlayerIn.rotationYaw - livingPlayerIn.prevRotationYaw) * partialTicks;
this.playerViewX = livingPlayerIn.prevRotationPitch + (livingPlayerIn.rotationPitch - livingPlayerIn.prevRotationPitch) * partialTicks;
}
if (optionsIn.thirdPersonView == 2)
{
this.playerViewY += 180.0F;
}
this.viewerPosX = livingPlayerIn.lastTickPosX + (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double)partialTicks;
this.viewerPosY = livingPlayerIn.lastTickPosY + (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double)partialTicks;
this.viewerPosZ = livingPlayerIn.lastTickPosZ + (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double)partialTicks;
}