當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityPlayerSP.getEyeHeight方法代碼示例

本文整理匯總了Java中net.minecraft.client.entity.EntityPlayerSP.getEyeHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityPlayerSP.getEyeHeight方法的具體用法?Java EntityPlayerSP.getEyeHeight怎麽用?Java EntityPlayerSP.getEyeHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.entity.EntityPlayerSP的用法示例。


在下文中一共展示了EntityPlayerSP.getEyeHeight方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onRender

import net.minecraft.client.entity.EntityPlayerSP; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRender(RenderGameOverlayEvent.Post event) {
    EntityPlayerSP playerIn = Minecraft.getMinecraft().player;
    if (!playerIn.getHeldItemMainhand().getItem().equals(ItemRegistry.bookManualItem) || Minecraft.getMinecraft().currentScreen != null)
        return;
    float f = playerIn.rotationPitch;
    float f1 = playerIn.rotationYaw;
    double d0 = playerIn.posX;
    double d1 = playerIn.posY + (double) playerIn.getEyeHeight();
    double d2 = playerIn.posZ;
    Vec3d vec3d = new Vec3d(d0, d1, d2);
    float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI);
    float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI);
    float f4 = -MathHelper.cos(-f * 0.017453292F);
    float f5 = MathHelper.sin(-f * 0.017453292F);
    float f6 = f3 * f4;
    float f7 = f2 * f4;
    double d3 = 5.0D;
    Vec3d vec3d1 = vec3d.addVector((double) f6 * d3, (double) f5 * d3, (double) f7 * d3);
    RayTraceResult result = Minecraft.getMinecraft().world.rayTraceBlocks(vec3d, vec3d1, false, true, false);
    if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) {
        BlockPos pos = result.getBlockPos();
        if (Minecraft.getMinecraft().world.getBlockState(pos).getBlock().getRegistryName().getResourceDomain().equals(Reference.MOD_ID)) {
            Minecraft.getMinecraft().fontRenderer.drawString(TextFormatting.GOLD + "SNEAK" + TextFormatting.WHITE + "+" + TextFormatting.GOLD + "Right Click", event.getResolution().getScaledWidth() / 2 + 10, event.getResolution().getScaledHeight() / 2 - 5, 0xFFFFFF, true);
            Minecraft.getMinecraft().fontRenderer.drawString(TextFormatting.YELLOW + "Open Block Description", event.getResolution().getScaledWidth() / 2 + 10, event.getResolution().getScaledHeight() / 2 - 5 + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 2, 0xFFFFFF, true);

        }
    }
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:31,代碼來源:IFWorldRenderLastEvent.java

示例2: renderOverlays

import net.minecraft.client.entity.EntityPlayerSP; //導入方法依賴的package包/類
/**
 * Renders all the overlays that are in first person mode. Args: partialTickTime
 */
public void renderOverlays(float partialTicks)
{
    GlStateManager.disableAlpha();

    if (this.mc.thePlayer.isEntityInsideOpaqueBlock())
    {
        IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer));
        BlockPos blockpos = new BlockPos(this.mc.thePlayer);
        EntityPlayerSP entityplayersp = this.mc.thePlayer;

        for (int i = 0; i < 8; ++i)
        {
            double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F);
            double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F);
            double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F);
            BlockPos blockpos1 = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2);
            IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos1);

            if (iblockstate1.getBlock().isVisuallyOpaque())
            {
                iblockstate = iblockstate1;
                blockpos = blockpos1;
            }
        }

        if (iblockstate.getBlock().getRenderType() != -1)
        {
            Object object = Reflector.getFieldValue(Reflector.RenderBlockOverlayEvent_OverlayType_BLOCK);

            if (!Reflector.callBoolean(Reflector.ForgeEventFactory_renderBlockOverlay, new Object[] {this.mc.thePlayer, Float.valueOf(partialTicks), object, iblockstate, blockpos}))
            {
                this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate));
            }
        }
    }

    if (!this.mc.thePlayer.isSpectator())
    {
        if (this.mc.thePlayer.isInsideOfMaterial(Material.water) && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderWaterOverlay, new Object[] {this.mc.thePlayer, Float.valueOf(partialTicks)}))
        {
            this.renderWaterOverlayTexture(partialTicks);
        }

        if (this.mc.thePlayer.isBurning() && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderFireOverlay, new Object[] {this.mc.thePlayer, Float.valueOf(partialTicks)}))
        {
            this.renderFireInFirstPerson(partialTicks);
        }
    }

    GlStateManager.enableAlpha();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:55,代碼來源:ItemRenderer.java


注:本文中的net.minecraft.client.entity.EntityPlayerSP.getEyeHeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。