本文整理汇总了Java中net.minecraft.init.Blocks.bed方法的典型用法代码示例。如果您正苦于以下问题:Java Blocks.bed方法的具体用法?Java Blocks.bed怎么用?Java Blocks.bed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.init.Blocks
的用法示例。
在下文中一共展示了Blocks.bed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBedSpawnLocation
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
* Return null if bed is invalid
*/
public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn)
{
Block block = worldIn.getBlockState(bedLocation).getBlock();
if (block != Blocks.bed)
{
if (!forceSpawn)
{
return null;
}
else
{
boolean flag = block.func_181623_g();
boolean flag1 = worldIn.getBlockState(bedLocation.up()).getBlock().func_181623_g();
return flag && flag1 ? bedLocation : null;
}
}
else
{
return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0);
}
}
示例2: shouldMoveTo
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
* Return true to set given position as destination
*/
protected boolean shouldMoveTo(World worldIn, BlockPos pos)
{
if (!worldIn.isAirBlock(pos.up()))
{
return false;
}
else
{
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
if (block == Blocks.chest)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityChest && ((TileEntityChest)tileentity).numPlayersUsing < 1)
{
return true;
}
}
else
{
if (block == Blocks.lit_furnace)
{
return true;
}
if (block == Blocks.bed && iblockstate.getValue(BlockBed.PART) != BlockBed.EnumPartType.HEAD)
{
return true;
}
}
return false;
}
}
示例3: wakeUpPlayer
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
* Wake up the player if they're sleeping.
*/
public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn)
{
this.setSize(0.6F, 1.8F);
IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation);
if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed)
{
this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4);
BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0);
if (blockpos == null)
{
blockpos = this.playerLocation.up();
}
this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F));
}
this.sleeping = false;
if (!this.worldObj.isRemote && updateWorldFlag)
{
this.worldObj.updateAllPlayersSleepingFlag();
}
this.sleepTimer = p_70999_1_ ? 0 : 100;
if (setSpawn)
{
this.setSpawnPoint(this.playerLocation, false);
}
}
示例4: getConversionTimeBoost
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
* Return the amount of time decremented from conversionTime every tick.
*/
protected int getConversionTimeBoost()
{
int i = 1;
if (this.rand.nextFloat() < 0.01F)
{
int j = 0;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k = (int)this.posX - 4; k < (int)this.posX + 4 && j < 14; ++k)
{
for (int l = (int)this.posY - 4; l < (int)this.posY + 4 && j < 14; ++l)
{
for (int i1 = (int)this.posZ - 4; i1 < (int)this.posZ + 4 && j < 14; ++i1)
{
Block block = this.worldObj.getBlockState(blockpos$mutableblockpos.func_181079_c(k, l, i1)).getBlock();
if (block == Blocks.iron_bars || block == Blocks.bed)
{
if (this.rand.nextFloat() < 0.3F)
{
++i;
}
++j;
}
}
}
}
}
return i;
}
示例5: cacheActiveRenderInfo
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks)
{
this.worldObj = worldIn;
this.options = optionsIn;
this.livingPlayer = 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 == Blocks.bed)
{
int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).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;
}
示例6: isInBed
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
private boolean isInBed()
{
return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed;
}
示例7: cacheActiveRenderInfo
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks)
{
this.worldObj = worldIn;
this.options = optionsIn;
this.livingPlayer = 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 (Reflector.callBoolean(Reflector.ForgeBlock_isBed, new Object[] {worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn}))
{
EnumFacing enumfacing = (EnumFacing)Reflector.call(block, Reflector.ForgeBlock_getBedDirection, new Object[] {worldIn, new BlockPos(livingPlayerIn)});
int i = enumfacing.getHorizontalIndex();
this.playerViewY = (float)(i * 90 + 180);
this.playerViewX = 0.0F;
}
else if (block == Blocks.bed)
{
int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex();
this.playerViewY = (float)(j * 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;
}