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


Java EnumFacing.getHorizontalIndex方法代码示例

本文整理汇总了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();
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:8,代码来源:BloodPlacer.java

示例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;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:16,代码来源:FacingHelper.java

示例3: getMetaFromState

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public int getMetaFromState(IBlockState state) {
	final EnumFacing facing = state.getValue(FACING);
	return facing.getHorizontalIndex();
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:6,代码来源:BlockBeehive.java

示例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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:43,代码来源:RenderManager.java

示例5: getBoundingBoxIndex

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
private static int getBoundingBoxIndex(EnumFacing p_185729_0_)
{
    return 1 << p_185729_0_.getHorizontalIndex();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:BlockPane.java

示例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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:43,代码来源:RenderManager.java


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