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);
}
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();
}
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();
}
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();
}
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();
}
Aggregations