net.minecraft.client.Minecraft.isGuiEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中net.minecraft.client.Minecraft.isGuiEnabled()方法的一些代码示例,展示了Minecraft.isGuiEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Minecraft.isGuiEnabled()方法的具体详情如下:
包路径:net.minecraft.client.Minecraft
类名称:Minecraft
方法名:isGuiEnabled

Minecraft.isGuiEnabled介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Quark

@Override
  protected void renderName(EntityItemFrame entity, double x, double y, double z) {
    if(Minecraft.isGuiEnabled() && !entity.getDisplayedItem().isEmpty() && entity.getDisplayedItem().hasDisplayName() && renderManager.pointedEntity == entity) {
      double d0 = entity.getDistanceSq(renderManager.renderViewEntity);
      float f = entity.isSneaking() ? 32.0F : 64.0F;

      if(d0 < f * f) {
        String s = entity.getDisplayedItem().getDisplayName();
        renderLivingLabel(entity, s, x, y, z, 64);
      }
    }
  }
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@SubscribeEvent
  public void onRenderWorldLast(RenderWorldLastEvent event) {

    Minecraft mc = Minecraft.getMinecraft();
    if (!Minecraft.isGuiEnabled())
      return;
    
    Entity cameraEntity = mc.getRenderViewEntity();
    Frustum frustrum = new Frustum();
    double viewX = cameraEntity.lastTickPosX + (cameraEntity.posX - cameraEntity.lastTickPosX) * event.getPartialTicks();
    double viewY = cameraEntity.lastTickPosY + (cameraEntity.posY - cameraEntity.lastTickPosY) * event.getPartialTicks();
    double viewZ = cameraEntity.lastTickPosZ + (cameraEntity.posZ - cameraEntity.lastTickPosZ) * event.getPartialTicks();
    frustrum.setPosition(viewX, viewY, viewZ);

    List<Entity> loadedEntities = mc.world.getLoadedEntityList();
    for (Entity entity : loadedEntities) {
      if (entity != null && entity instanceof DinosaurEntity) {
        if (entity.isInRangeToRender3d(cameraEntity.getPosition().getX(), cameraEntity.getPosition().getY(), cameraEntity.getPosition().getZ()) && (frustrum.isBoundingBoxInFrustum(entity.getRenderBoundingBox().grow(0.5D))) && entity.isEntityAlive()) {
          ((DinosaurEntity) entity).isRendered = true;
        } else {
          ((DinosaurEntity) entity).isRendered = false;
        }
      }
    }
  }
}

代码示例来源:origin: TehNut/HWYLA

public static void renderOverlay() {
  if (WailaTickHandler.instance().tooltip == null)
    return;
  if (!ConfigHandler.instance().showTooltip())
    return;
  Minecraft mc = Minecraft.getMinecraft();
  if (mc.currentScreen != null || mc.world == null)
    return;
  if (ConfigHandler.instance().hideFromList() && (mc.gameSettings.keyBindPlayerList.isKeyDown() && !mc.isIntegratedServerRunning()))
    return;
  if (!Minecraft.isGuiEnabled())
    return;
  if (mc.gameSettings.showDebugInfo && ConfigHandler.instance().hideFromDebug())
    return;
  if (RayTracing.instance().getTarget() == null)
    return;
  if (RayTracing.instance().getTarget().typeOfHit == RayTraceResult.Type.BLOCK && !RayTracing.instance().getTargetStack().isEmpty())
    renderOverlay(WailaTickHandler.instance().tooltip);
  if (RayTracing.instance().getTarget().typeOfHit == RayTraceResult.Type.ENTITY && ConfigHandler.instance().getConfig("general.showents"))
    renderOverlay(WailaTickHandler.instance().tooltip);
}

代码示例来源:origin: thraaawn/CompactMachines

@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void renderRotationIndicator(RenderWorldLastEvent event) {
  if(!Minecraft.isGuiEnabled() || Minecraft.getMinecraft().player == null) {
    return;

相关文章