当前位置: 首页>>代码示例>>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;未经允许,请勿转载。