net.minecraft.profiler.Profiler.endSection()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(87)

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

Profiler.endSection介绍

暂无

代码示例

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

@Override
public void update() {
  if(subTile != null) {
    world.profiler.startSection(subTileName);
    TileEntity tileBelow = world.getTileEntity(pos.down());
    if(tileBelow instanceof TileRedStringRelay) {
      BlockPos coords = ((TileRedStringRelay) tileBelow).getBinding();
      if(coords != null) {
        BlockPos currPos = pos;
        setPos(coords);
        subTile.onUpdate();
        setPos(currPos);
        world.profiler.endSection();
        return;
      }
    }
    boolean special = isOnSpecialSoil();
    if(special) {
      subTile.overgrowth = true;
      if(subTile.isOvergrowthAffected()) {
        subTile.onUpdate();
        subTile.overgrowthBoost = true;
      }
    }
    subTile.onUpdate();
    subTile.overgrowth = false;
    subTile.overgrowthBoost = false;
    world.profiler.endSection();
  }
}

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

private static void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
  Minecraft mc = Minecraft.getMinecraft();
  Profiler profiler = mc.profiler;
  profiler.startSection("wandMode");
  int ticks = mc.ingameGUI.remainingHighlightTicks;
  ticks -= 15;
  if(ticks > 0) {
    int alpha = Math.min(255, (int) (ticks * 256.0F / 10.0F));
    int color = 0x00CC00 + (alpha << 24);
    String disp = I18n.format(ItemTwigWand.getModeString(stack));
    int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(disp) / 2;
    int y = res.getScaledHeight() - 70;
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    mc.fontRenderer.drawStringWithShadow(disp, x, y, color);
    GlStateManager.disableBlend();
  }
  profiler.endSection();
}

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

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
  Minecraft mc = Minecraft.getMinecraft();
  Profiler profiler = mc.profiler;
  if(event.getType() == ElementType.HEALTH) {
    profiler.startSection("botania-hud");
    IItemHandler baublesInv = BaublesApi.getBaublesHandler(mc.player);
    ItemStack headpiece = baublesInv.getStackInSlot(4);
    if(!headpiece.isEmpty() && headpiece.getItem() == ModItems.flightTiara) {
      profiler.startSection("flugelTiara");
      ItemFlightTiara.renderHUD(event.getResolution(), mc.player, headpiece);
      profiler.endSection();
    }
    dodgeRing: {
      ItemStack ring = baublesInv.getStackInSlot(1);
      if(ring.isEmpty() || !(ring.getItem() instanceof ItemDodgeRing)) {
        ring = baublesInv.getStackInSlot(2);
        if(ring.isEmpty() || !(ring.getItem() instanceof ItemDodgeRing))
          break dodgeRing;
      }
      profiler.startSection("dodgeRing");
      ItemDodgeRing.renderHUD(event.getResolution(), mc.player, ring, event.getPartialTicks());
      profiler.endSection();
    }
    profiler.endSection();
  }
}

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

world.profiler.startSection("findRecipe");
RecipePureDaisy recipe = findRecipe(coords);
world.profiler.endSection();

代码示例来源:origin: SleepyTrousers/EnderIO

public static void stop(@Nullable Profiler profiler) {
 if (--counter.get().count >= 0) {
  if (profiler != null) {
   profiler.endSection();
  }
 } else {
  new RuntimeException("Profiler underflow!").printStackTrace();
 }
}

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

private static void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
  Minecraft mc = Minecraft.getMinecraft();
  Profiler profiler = mc.profiler;
  profiler.startSection("crystalCube");
  ItemStack target = tile.getRequestTarget();
  if(!target.isEmpty()) {
    String s1 = target.getDisplayName();
    String s2 = tile.getItemCount() + "x";
    int strlen = Math.max(mc.fontRenderer.getStringWidth(s1), mc.fontRenderer.getStringWidth(s2));
    int w = res.getScaledWidth();
    int h = res.getScaledHeight();
    Gui.drawRect(w / 2 + 8, h / 2 - 12, w / 2 + strlen + 32, h / 2 + 10, 0x44000000);
    Gui.drawRect(w / 2 + 6, h / 2 - 14, w / 2 + strlen + 34, h / 2 + 12, 0x44000000);
    mc.fontRenderer.drawStringWithShadow(target.getDisplayName(), w / 2 + 30, h / 2 - 10, 0x6666FF);
    mc.fontRenderer.drawStringWithShadow(tile.getItemCount() + "x", w / 2 + 30, h / 2, 0xFFFFFF);
    net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    mc.getRenderItem().renderItemAndEffectIntoGUI(target, w / 2 + 10, h / 2 - 10);
    net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
  }
  profiler.endSection();
}

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

profiler.startSection("wandItem");
        ((IWandHUD) block).renderHUD(mc, event.getResolution(), mc.world, pos.getBlockPos());
        profiler.endSection();
  profiler.startSection("nearIndex");
  renderNearIndexDisplay(event.getResolution());
  profiler.endSection();
  String s = I18n.format("botaniamisc.rightClickToAnchor");
  mc.fontRenderer.drawStringWithShadow(s, event.getResolution().getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(s) / 2, event.getResolution().getScaledHeight() / 2 - 30, 0xFFFFFF);
  profiler.endSection();
  profiler.startSection("craftingHalo_main");
  ItemCraftingHalo.renderHUD(event.getResolution(), mc.player, main);
  profiler.endSection();
} else if(!offhand.isEmpty() && offhand.getItem() instanceof ItemCraftingHalo) {
  profiler.startSection("craftingHalo_off");
  ItemCraftingHalo.renderHUD(event.getResolution(), mc.player, offhand);
  profiler.endSection();
  profiler.startSection("sextant");
  ItemSextant.renderHUD(event.getResolution(), mc.player, main);
  profiler.endSection();
  profiler.startSection("monocle");
  ItemMonocle.renderHUD(event.getResolution(), mc.player);
  profiler.endSection();
profiler.endSection();

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

public static void dispatch() {
  Tessellator tessellator = Tessellator.getInstance();
  Profiler profiler = Minecraft.getMinecraft().profiler;
  GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
  GlStateManager.depthMask(false);
  GlStateManager.enableBlend();
  GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
  GlStateManager.alphaFunc(GL11.GL_GREATER, 0.003921569F);
  GlStateManager.disableLighting();
  profiler.startSection("sparkle");
  FXSparkle.dispatchQueuedRenders(tessellator);
  profiler.endStartSection("wisp");
  FXWisp.dispatchQueuedRenders(tessellator);
  profiler.endSection();
  GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
  GlStateManager.disableBlend();
  GlStateManager.depthMask(true);
  GL11.glPopAttrib();
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void endSection() {
 if (this.profilingEnabled && !isBlacklisted(new RuntimeException())) {
  super.endSection();
 }
}

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

GlStateManager.popMatrix();
profiler.endSection();
profiler.endSection();

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

profiler.endSection();
profiler.endSection();

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

private static void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
  Minecraft mc = Minecraft.getMinecraft();
  Profiler profiler = mc.profiler;
  profiler.startSection("poolRecipe");
  RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
  if(recipe != null) {
    int x = res.getScaledWidth() / 2 - 11;
    int y = res.getScaledHeight() / 2 + 10;
    int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
    int v = mc.player.getName().equals("haighyorkie") && mc.player.isSneaking() ? 23 : 8;
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    mc.renderEngine.bindTexture(manaBar);
    RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
    GlStateManager.color(1F, 1F, 1F, 1F);
    net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
    mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x - 20, y);
    mc.getRenderItem().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
    mc.getRenderItem().renderItemOverlays(mc.fontRenderer, recipe.getOutput(), x + 26, y);
    net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
    GlStateManager.disableLighting();
    GlStateManager.disableBlend();
  }
  profiler.endSection();
}

代码示例来源:origin: DimensionalDevelopment/VanillaFix

/**
   * @reason Add a profiler section for the tick limit wait (similar to client's FPS limit wait)
   */
  @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/lang/Thread;sleep(J)V"))
  private void addTickLimitWaitProfiler(long millis) throws InterruptedException {
    profiler.startSection("root");
    profiler.startSection("tickLimitWait");
    Thread.sleep(millis);
    profiler.endSection();
    profiler.endSection();
  }
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
protected final void updateWorksite() {
  world.profiler.startSection("Incremental Scan");
  if (blocksToUpdate.isEmpty() && hasWorkBounds()) {
    fillBlocksToProcess(blocksToUpdate);
  }
  if (!blocksToUpdate.isEmpty()) {
    BlockPos pos = blocksToUpdate.poll();
    scanBlockPosition(pos);
  }
  world.profiler.endSection();
  updateBlockWorksite();
}

代码示例来源:origin: DimensionalDevelopment/VanillaFix

@Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/shader/Framebuffer;unbindFramebuffer()V", ordinal = 0))
private void onRenderEnd(CallbackInfo ci) {
  if (drawTextureMap) {
    Minecraft.getMinecraft().profiler.startSection("root");
    Minecraft.getMinecraft().profiler.startSection("drawTextureMap");
    TextureMapRenderer.draw();
    Minecraft.getMinecraft().profiler.endSection();
    Minecraft.getMinecraft().profiler.endSection();
  }
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

private Path pathToXYZ(BlockPos pos) {
  ChunkCache chunkcache = cachePath(0, 8);
  Path pathentity = (new PathFinder(nodeProcessor).findPath(chunkcache, mountOrEntity(), pos, this.getPathSearchRange()));
  this.world.profiler.endSection();
  return pathentity;
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

private void updateBlockWorksite() {
  world.profiler.startSection("Items Pickup");
  if (world.getWorldTime() % 20 == 0) {
    pickupItems();
  }
  world.profiler.endStartSection("Count Resources");
  if (shouldCountResources) {
    countResources();
    shouldCountResources = false;
  }
  world.profiler.endSection();
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

private Path pathToEntity(Entity target) {
  ChunkCache chunkcache = cachePath(1, 16);
  Path pathentity = (new PathFinder(nodeProcessor).findPath(chunkcache, mountOrEntity(), target, this.getPathSearchRange()));
  this.world.profiler.endSection();
  return pathentity;
}

代码示例来源:origin: Electrical-Age/ElectricalAge

@Override
public void draw() {
  Minecraft.getMinecraft().mcProfiler.startSection("ECable");
  Utils.setGlColorFromDye(color, 1.0f);
  UtilsClient.bindTexture(descriptor.render.cableTexture);
  glListCall();
  GL11.glColor3f(1f, 1f, 1f);
  Minecraft.getMinecraft().mcProfiler.endSection();
}

代码示例来源:origin: CoFH/CoFHCore

public static void transferEntityToWorld(Entity entity, double x, double y, double z, WorldServer oldWorld, WorldServer newWorld) {
  oldWorld.profiler.startSection("placing");
  x = MathHelper.clamp(x, -29999872, 29999872);
  z = MathHelper.clamp(z, -29999872, 29999872);
  if (entity.isEntityAlive()) {
    entity.setLocationAndAngles(x, y, z, entity.rotationYaw, entity.rotationPitch);
    newWorld.spawnEntity(entity);
    newWorld.updateEntityWithOptionalForce(entity, false);
  }
  oldWorld.profiler.endSection();
  entity.setWorld(newWorld);
}

相关文章