Search in sources :

Example 1 with Profiler

use of net.minecraft.profiler.Profiler in project EnderIO by SleepyTrousers.

the class ServerTickHandler method onServerTick.

@SubscribeEvent
public static void onServerTick(@Nonnull TickEvent.ServerTickEvent event) {
    Profiler profiler = FMLCommonHandler.instance().getMinecraftServerInstance().profiler;
    if (!profiler.profilingEnabled) {
        profiler = null;
    }
    // this event is fired outside the profiler's normal coverage...
    Prof.start(profiler, "root");
    Prof.start(profiler, "ServerTickEvent_" + event.phase);
    for (Entry<ITickListener, String> entry : listeners.entrySet()) {
        Prof.start(profiler, NullHelper.first(entry.getValue(), "(unnamed)"));
        if (event.phase == Phase.START) {
            entry.getKey().tickStart(event, profiler);
        } else {
            entry.getKey().tickEnd(event, profiler);
        }
        Prof.stop(profiler);
    }
    Prof.stop(profiler, 2);
}
Also used : Profiler(net.minecraft.profiler.Profiler) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with Profiler

use of net.minecraft.profiler.Profiler in project BuildCraft by BuildCraft.

the class RenderEngine_BC8 method renderTileEntityFast.

// TODO: Cache the model!
@Override
public void renderTileEntityFast(@Nonnull T engine, double x, double y, double z, float partialTicks, int destroyStage, float partial, @Nonnull BufferBuilder vb) {
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;
    profiler.startSection("bc");
    profiler.startSection("engine");
    profiler.startSection("compute");
    vb.setTranslation(x, y, z);
    MutableQuad[] quads = getEngineModel(engine, partialTicks);
    profiler.endStartSection("render");
    MutableQuad copy = new MutableQuad(0, null);
    int lightc = engine.getWorld().getCombinedLight(engine.getPos(), 0);
    int light_block = (lightc >> 4) & 15;
    int light_sky = (lightc >> 20) & 15;
    for (MutableQuad q : quads) {
        copy.copyFrom(q);
        copy.maxLighti(light_block, light_sky);
        copy.multShade();
        copy.render(vb);
    }
    vb.setTranslation(0, 0, 0);
    profiler.endSection();
    profiler.endSection();
    profiler.endSection();
}
Also used : Profiler(net.minecraft.profiler.Profiler) MutableQuad(buildcraft.lib.client.model.MutableQuad)

Example 3 with Profiler

use of net.minecraft.profiler.Profiler in project BuildCraft by BuildCraft.

the class RenderDistiller method render.

@Override
public void render(TileDistiller_BC8 tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    super.render(tile, x, y, z, partialTicks, destroyStage, alpha);
    IBlockState state = tile.getWorld().getBlockState(tile.getPos());
    if (state.getBlock() != BCFactoryBlocks.distiller) {
        return;
    }
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;
    profiler.startSection("bc");
    profiler.startSection("distiller");
    int combinedLight = tile.getWorld().getCombinedLight(tile.getPos(), 0);
    EnumFacing face = state.getValue(BlockBCBase_Neptune.PROP_FACING);
    TankRenderSizes sizes = TANK_SIZES.get(face);
    // gl state setup
    RenderHelper.disableStandardItemLighting();
    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
    // buffer setup
    BufferBuilder bb = Tessellator.getInstance().getBuffer();
    bb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    bb.setTranslation(x, y, z);
    profiler.startSection("model");
    profiler.startSection("compute");
    if (tile.clientModelData.hasNoNodes()) {
        tile.clientModelData.setNodes(BCFactoryModels.DISTILLER.createTickableNodes());
    }
    tile.setClientModelVariables(partialTicks);
    tile.clientModelData.refresh();
    MutableQuad[] quads = BCFactoryModels.DISTILLER.getCutoutQuads();
    profiler.endStartSection("render");
    MutableQuad copy = new MutableQuad(0, null);
    int lightc = combinedLight;
    int light_block = (lightc >> 4) & 15;
    int light_sky = (lightc >> 20) & 15;
    for (MutableQuad q : quads) {
        copy.copyFrom(q);
        copy.maxLighti(light_block, light_sky);
        copy.multShade();
        copy.render(bb);
    }
    profiler.endSection();
    profiler.endStartSection("fluid");
    renderTank(sizes.tankIn, tile.smoothedTankIn, combinedLight, partialTicks, bb);
    renderTank(sizes.tankOutGas, tile.smoothedTankGasOut, combinedLight, partialTicks, bb);
    renderTank(sizes.tankOutLiquid, tile.smoothedTankLiquidOut, combinedLight, partialTicks, bb);
    // buffer finish
    bb.setTranslation(0, 0, 0);
    profiler.endStartSection("draw");
    Tessellator.getInstance().draw();
    // gl state finish
    RenderHelper.enableStandardItemLighting();
    profiler.endSection();
    profiler.endSection();
    profiler.endSection();
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) Profiler(net.minecraft.profiler.Profiler) EnumFacing(net.minecraft.util.EnumFacing) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) MutableQuad(buildcraft.lib.client.model.MutableQuad)

Example 4 with Profiler

use of net.minecraft.profiler.Profiler in project BuildCraft by BuildCraft.

the class LaserRenderer_BC8 method renderLaserDynamic.

/**
 * Assumes the buffer uses {@link DefaultVertexFormats#BLOCK}
 */
public static void renderLaserDynamic(LaserData_BC8 data, BufferBuilder buffer) {
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;
    profiler.startSection("compute");
    LaserCompiledBuffer compiled = COMPILED_DYNAMIC_LASERS.getUnchecked(data);
    profiler.endStartSection("render");
    compiled.render(buffer);
    profiler.endSection();
}
Also used : Profiler(net.minecraft.profiler.Profiler)

Example 5 with Profiler

use of net.minecraft.profiler.Profiler in project BuildCraft by BuildCraft.

the class AtlasSpriteSwappable method updateAnimation.

@Override
public void updateAnimation() {
    if (current == null) {
        copyFrom(Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite());
        return;
    }
    Profiler p = Minecraft.getMinecraft().mcProfiler;
    // MAPPING: func_194340_a: Profiler.startSection
    p.func_194340_a(getClass()::getSimpleName);
    if (needsSwapping) {
        p.startSection("copy");
        current.copyFrom(this);
        p.endSection();
    }
    if (current.hasAnimationMetadata() && BCLibConfig.enableAnimatedSprites) {
        p.startSection("update");
        p.startSection(getIconName());
        current.updateAnimation();
        p.endSection();
        p.endSection();
    } else if (needsSwapping) {
        p.startSection("swap");
        TextureUtil.uploadTextureMipmap(current.getFrameTextureData(0), current.getIconWidth(), current.getIconHeight(), current.getOriginX(), current.getOriginY(), false, false);
        p.endSection();
    }
    needsSwapping = false;
    p.endSection();
}
Also used : Profiler(net.minecraft.profiler.Profiler)

Aggregations

Profiler (net.minecraft.profiler.Profiler)15 Vec3d (net.minecraft.util.math.Vec3d)4 EnumFacing (net.minecraft.util.EnumFacing)3 BlockPos (net.minecraft.util.math.BlockPos)3 MutableQuad (buildcraft.lib.client.model.MutableQuad)2 LaserData_BC8 (buildcraft.lib.client.render.laser.LaserData_BC8)2 IBlockState (net.minecraft.block.state.IBlockState)2 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)2 ItemStack (net.minecraft.item.ItemStack)2 World (net.minecraft.world.World)2 TileQuarry (buildcraft.builders.tile.TileQuarry)1 EnumProgressState (buildcraft.factory.tile.TileHeatExchange.EnumProgressState)1 ExchangeSectionEnd (buildcraft.factory.tile.TileHeatExchange.ExchangeSectionEnd)1 ExchangeSectionStart (buildcraft.factory.tile.TileHeatExchange.ExchangeSectionStart)1 LaserType (buildcraft.lib.client.render.laser.LaserData_BC8.LaserType)1 GameProfile (com.mojang.authlib.GameProfile)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Tessellator (net.minecraft.client.renderer.Tessellator)1 EntityItem (net.minecraft.entity.item.EntityItem)1