本文整理汇总了Java中net.minecraft.util.EnumFacing.getHorizontalIndex方法的典型用法代码示例。如果您正苦于以下问题:Java EnumFacing.getHorizontalIndex方法的具体用法?Java EnumFacing.getHorizontalIndex怎么用?Java EnumFacing.getHorizontalIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.EnumFacing
的用法示例。
在下文中一共展示了EnumFacing.getHorizontalIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStateFromMeta
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public IBlockState getStateFromMeta(int meta) {
for(EnumFacing facing : EnumFacing.HORIZONTALS)
if(facing.getHorizontalIndex() == meta)
return this.getDefaultState().withProperty(FACING, facing);
return this.getDefaultState();
}
示例2: getHorizontalRotation
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public static Rotation getHorizontalRotation(EnumFacing from, EnumFacing to) {
if(from.getAxis().isVertical() || to.getAxis().isVertical()) return Rotation.NONE;
if(from.getOpposite() == to) {
return Rotation.CLOCKWISE_180;
} else if(from != to) {
int indexFrom = from.getHorizontalIndex();
int indexTo = to.getHorizontalIndex();
if(indexFrom < indexTo || (indexFrom == 3 && indexTo == 0)) {
return Rotation.CLOCKWISE_90;
} else {
return Rotation.COUNTERCLOCKWISE_90;
}
}
return Rotation.NONE;
}
示例3: getMetaFromState
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public int getMetaFromState(IBlockState state) {
final EnumFacing facing = state.getValue(FACING);
return facing.getHorizontalIndex();
}
示例4: cacheActiveRenderInfo
import net.minecraft.util.EnumFacing; //导入方法依赖的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;
}
示例5: getBoundingBoxIndex
import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
private static int getBoundingBoxIndex(EnumFacing p_185729_0_)
{
return 1 << p_185729_0_.getHorizontalIndex();
}
示例6: cacheActiveRenderInfo
import net.minecraft.util.EnumFacing; //导入方法依赖的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 (Reflector.callBoolean(block, Reflector.ForgeBlock_isBed, new Object[] {iblockstate, worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn}))
{
EnumFacing enumfacing = (EnumFacing)Reflector.call(block, Reflector.ForgeBlock_getBedDirection, new Object[] {iblockstate, 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;
}