當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。