EventHandler.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:Morph 作者:
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onRenderSpecials(RenderLivingEvent.Specials.Pre event)
{
    Iterator<Entry<String, MorphInfoClient>> ite = Morph.proxy.tickHandlerClient.playerMorphInfo.entrySet().iterator();
    while(ite.hasNext())
    {
        Entry<String, MorphInfoClient> e = ite.next();
        if(e.getValue().nextState.entInstance == event.entity || e.getValue().prevState != null && e.getValue().prevState.entInstance == event.entity)
        {
            if(e.getValue().prevState != null && e.getValue().prevState.entInstance instanceof EntityPlayer && !((EntityPlayer)e.getValue().prevState.entInstance).getCommandSenderName().equals(e.getKey()))
            {
                event.setCanceled(true);
            }
            EntityPlayer player = event.entity.worldObj.getPlayerEntityByName(e.getKey());
            if(player != null && !(e.getValue().nextState.entInstance instanceof EntityPlayer && ((EntityPlayer)e.getValue().nextState.entInstance).getCommandSenderName().equals(e.getKey())))
            {
                if(Morph.config.getSessionInt("showPlayerLabel") == 1)
                {
                    if(e.getValue().nextState.entInstance instanceof EntityPlayer && !((EntityPlayer)e.getValue().nextState.entInstance).getCommandSenderName().equals(e.getKey()))
                    {
                        event.setCanceled(true);
                    }
                    RenderPlayer rend = (RenderPlayer)RenderManager.instance.getEntityRenderObject(player);

                    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);

                    if(Minecraft.isGuiEnabled() && player != Minecraft.getMinecraft().thePlayer && !player.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer) && player.riddenByEntity == null)
                    {
                        float f = 1.6F;
                        float f1 = 0.016666668F * f;
                        double d3 = player.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer);
                        float f2 = player.isSneaking() ? RendererLivingEntity.NAME_TAG_RANGE_SNEAK : RendererLivingEntity.NAME_TAG_RANGE;

                        if(d3 < (double)(f2 * f2))
                        {
                            String s = player.func_145748_c_().getFormattedText();
                            rend.func_96449_a(player, event.x, event.y, event.z, s, f1, d3);
                        }
                    }
                }
            }
            break;
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号