Search in sources :

Example 1 with ProfilerFiller

use of net.minecraft.util.profiling.ProfilerFiller in project blueprint by team-abnormals.

the class ChunkGeneratorModificationManager method apply.

@Override
protected void apply(Map<ResourceLocation, JsonElement> map, ResourceManager resourceManager, ProfilerFiller profilerFiller) {
    RegistryOps<JsonElement> registryOps = this.registryOps;
    int loadedModifiers = 0;
    for (Map.Entry<ResourceLocation, JsonElement> entry : map.entrySet()) {
        try {
            TargetedModifier<ChunkGenerator, RegistryOps<JsonElement>, RegistryOps<JsonElement>> targetedModifier = TargetedModifier.deserialize(entry.getValue().getAsJsonObject(), registryOps, ChunkGeneratorModifiers.REGISTRY);
            this.modifiers.computeIfAbsent(targetedModifier.getPriority(), __ -> new LinkedList<>()).add(targetedModifier);
            loadedModifiers++;
        } catch (IllegalArgumentException | JsonParseException exception) {
            Blueprint.LOGGER.error("Parsing error loading Chunk Generator Modifier: {}", entry.getKey(), exception);
        }
    }
    Blueprint.LOGGER.info("Chunk Generator Modification Manager has loaded {} modifiers", loadedModifiers);
}
Also used : JsonParseException(com.google.gson.JsonParseException) SelectionSpace(com.teamabnormals.blueprint.core.util.modification.targeting.SelectionSpace) ResourceLocation(net.minecraft.resources.ResourceLocation) RegistryOps(net.minecraft.resources.RegistryOps) ProfilerFiller(net.minecraft.util.profiling.ProfilerFiller) EnumMap(java.util.EnumMap) ResourceManager(net.minecraft.server.packs.resources.ResourceManager) HashMap(java.util.HashMap) TargetedModifier(com.teamabnormals.blueprint.core.util.modification.TargetedModifier) AddReloadListenerEvent(net.minecraftforge.event.AddReloadListenerEvent) Blueprint(com.teamabnormals.blueprint.core.Blueprint) ConfiguredModifier(com.teamabnormals.blueprint.core.util.modification.ConfiguredModifier) JsonElement(com.google.gson.JsonElement) ChunkGenerator(net.minecraft.world.level.chunk.ChunkGenerator) MinecraftForge(net.minecraftforge.common.MinecraftForge) SimpleJsonResourceReloadListener(net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener) Gson(com.google.gson.Gson) EventPriority(net.minecraftforge.eventbus.api.EventPriority) Map(java.util.Map) Mod(net.minecraftforge.fml.common.Mod) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) DataUtil(com.teamabnormals.blueprint.core.util.DataUtil) ServerAboutToStartEvent(net.minecraftforge.event.server.ServerAboutToStartEvent) LinkedList(java.util.LinkedList) RegistryOps(net.minecraft.resources.RegistryOps) JsonParseException(com.google.gson.JsonParseException) Blueprint(com.teamabnormals.blueprint.core.Blueprint) LinkedList(java.util.LinkedList) JsonElement(com.google.gson.JsonElement) ResourceLocation(net.minecraft.resources.ResourceLocation) ChunkGenerator(net.minecraft.world.level.chunk.ChunkGenerator) EnumMap(java.util.EnumMap) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with ProfilerFiller

use of net.minecraft.util.profiling.ProfilerFiller in project pollen by MoonflowerTeam.

the class AnimatedGeometryEntityModel method setupAnim.

@Override
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float animationTicks, float netHeadYaw, float headPitch) {
    GeometryModel model = this.getModel();
    model.resetTransformation();
    if (model instanceof AnimatedModel && this.animations.length > 0) {
        ProfilerFiller profiler = Minecraft.getInstance().getProfiler();
        profiler.push("createMolangRuntime");
        MolangRuntime.Builder builder = this.createRuntime(entity, limbSwing, limbSwingAmount, netHeadYaw, headPitch);
        if (entity instanceof MolangVariableProvider)
            builder.setVariables((MolangVariableProvider) entity);
        if (this.variableProvider != null)
            builder.setVariables(this.variableProvider);
        profiler.popPush("applyMolangAnimation");
        ((AnimatedModel) model).applyAnimations(animationTicks / 20F, builder, this.getAnimations());
        profiler.pop();
    }
}
Also used : GeometryModel(gg.moonflower.pollen.pinwheel.api.client.geometry.GeometryModel) MolangRuntime(io.github.ocelot.molangcompiler.api.MolangRuntime) MolangVariableProvider(io.github.ocelot.molangcompiler.api.bridge.MolangVariableProvider) ProfilerFiller(net.minecraft.util.profiling.ProfilerFiller)

Example 3 with ProfilerFiller

use of net.minecraft.util.profiling.ProfilerFiller in project pollen by MoonflowerTeam.

the class GeometryTextureSpriteUploader method prepare.

@Override
protected TextureAtlas.Preparations prepare(ResourceManager resourceManager, ProfilerFiller profiler) {
    try (OnlineRepository onlineRepository = new OnlineRepository(this.hashTables)) {
        profiler.startTick();
        profiler.push("stitching");
        Stopwatch stopwatch = Stopwatch.createUnstarted();
        this.beginStitch(System.currentTimeMillis(), stopwatch);
        TextureAtlas.Preparations sheetData = this.textureAtlas.prepareToStitch(new OnlineResourceManager(resourceManager, onlineRepository, this.textures.stream().filter(texture -> texture.getType() == GeometryModelTexture.Type.ONLINE).collect(Collectors.toSet())), this.textures.stream().filter(texture -> texture.getType() == GeometryModelTexture.Type.LOCATION || texture.getType() == GeometryModelTexture.Type.ONLINE).map(GeometryModelTexture::getLocation).distinct(), profiler, Minecraft.getInstance().options.mipmapLevels);
        this.endStitch(stopwatch);
        profiler.pop();
        profiler.endTick();
        return sheetData;
    }
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) JsonObject(com.google.gson.JsonObject) Resource(net.minecraft.server.packs.resources.Resource) java.util(java.util) TextureAtlas(net.minecraft.client.renderer.texture.TextureAtlas) Stopwatch(com.google.common.base.Stopwatch) TimedTextureCache(gg.moonflower.pollen.pinwheel.core.client.util.TimedTextureCache) MetadataSectionSerializer(net.minecraft.server.packs.metadata.MetadataSectionSerializer) Pollen(gg.moonflower.pollen.core.Pollen) FileCache(gg.moonflower.pollen.pinwheel.api.client.FileCache) SimplePreparableReloadListener(net.minecraft.server.packs.resources.SimplePreparableReloadListener) Pair(org.apache.commons.lang3.tuple.Pair) Minecraft(net.minecraft.client.Minecraft) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) GsonHelper(net.minecraft.util.GsonHelper) GeometryModelTextureTable(gg.moonflower.pollen.pinwheel.api.common.texture.GeometryModelTextureTable) Path(java.nio.file.Path) PackResources(net.minecraft.server.packs.PackResources) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ApiStatus(org.jetbrains.annotations.ApiStatus) ProfilerFiller(net.minecraft.util.profiling.ProfilerFiller) java.util.concurrent(java.util.concurrent) Predicate(java.util.function.Predicate) GeometryModelTexture(gg.moonflower.pollen.pinwheel.api.common.texture.GeometryModelTexture) ResourceManager(net.minecraft.server.packs.resources.ResourceManager) TextureManager(net.minecraft.client.renderer.texture.TextureManager) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Base32(org.apache.commons.codec.binary.Base32) HashedTextureCache(gg.moonflower.pollen.pinwheel.core.client.util.HashedTextureCache) GeometryAtlasTexture(gg.moonflower.pollen.pinwheel.api.client.texture.GeometryAtlasTexture) Nullable(org.jetbrains.annotations.Nullable) Util(net.minecraft.Util) Logger(org.apache.logging.log4j.Logger) Stream(java.util.stream.Stream) java.io(java.io) LogManager(org.apache.logging.log4j.LogManager) FilenameUtils(org.apache.commons.io.FilenameUtils) GeometryModelTexture(gg.moonflower.pollen.pinwheel.api.common.texture.GeometryModelTexture) TextureAtlas(net.minecraft.client.renderer.texture.TextureAtlas) Stopwatch(com.google.common.base.Stopwatch)

Example 4 with ProfilerFiller

use of net.minecraft.util.profiling.ProfilerFiller in project Iris by IrisShaders.

the class FullyBufferedMultiBufferSource method endBatch.

@Override
public void endBatch() {
    ProfilerFiller profiler = Minecraft.getInstance().getProfiler();
    profiler.push("collect");
    Map<RenderType, List<BufferSegment>> typeToSegment = new HashMap<>();
    for (SegmentedBufferBuilder builder : builders) {
        List<BufferSegment> segments = builder.getSegments();
        for (BufferSegment segment : segments) {
            typeToSegment.computeIfAbsent(segment.getRenderType(), (type) -> new ArrayList<>()).add(segment);
        }
    }
    profiler.popPush("resolve ordering");
    Iterable<RenderType> renderOrder = renderOrderManager.getRenderOrder();
    profiler.popPush("draw buffers");
    for (RenderType type : renderOrder) {
        type.setupRenderState();
        renderTypes += 1;
        for (BufferSegment segment : typeToSegment.getOrDefault(type, Collections.emptyList())) {
            segmentRenderer.drawInner(segment);
            drawCalls += 1;
        }
        type.clearRenderState();
    }
    profiler.popPush("reset");
    renderOrderManager.reset();
    affinities.clear();
    profiler.pop();
}
Also used : Iterator(java.util.Iterator) ProfilerFiller(net.minecraft.util.profiling.ProfilerFiller) WrappingMultiBufferSource(net.coderbot.iris.fantastic.WrappingMultiBufferSource) BufferBuilder(com.mojang.blaze3d.vertex.BufferBuilder) RenderType(net.minecraft.client.renderer.RenderType) HashMap(java.util.HashMap) Function(java.util.function.Function) RenderOrderManager(net.coderbot.batchedentityrendering.impl.ordering.RenderOrderManager) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) List(java.util.List) GraphTranslucencyRenderOrderManager(net.coderbot.batchedentityrendering.impl.ordering.GraphTranslucencyRenderOrderManager) Minecraft(net.minecraft.client.Minecraft) Map(java.util.Map) Collections(java.util.Collections) VertexConsumer(com.mojang.blaze3d.vertex.VertexConsumer) MultiBufferSource(net.minecraft.client.renderer.MultiBufferSource) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) RenderType(net.minecraft.client.renderer.RenderType) ProfilerFiller(net.minecraft.util.profiling.ProfilerFiller)

Example 5 with ProfilerFiller

use of net.minecraft.util.profiling.ProfilerFiller in project architectury-api by architectury.

the class MixinClientLevel method tickEntities.

@Inject(method = "tickEntities", at = @At("HEAD"))
private void tickEntities(CallbackInfo ci) {
    ProfilerFiller profiler = getProfiler();
    profiler.push("architecturyClientLevelPreTick");
    ClientTickEvent.CLIENT_LEVEL_PRE.invoker().tick((ClientLevel) (Object) this);
    profiler.pop();
}
Also used : ProfilerFiller(net.minecraft.util.profiling.ProfilerFiller) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

ProfilerFiller (net.minecraft.util.profiling.ProfilerFiller)10 ResourceLocation (net.minecraft.resources.ResourceLocation)5 ResourceManager (net.minecraft.server.packs.resources.ResourceManager)5 CompletableFuture (java.util.concurrent.CompletableFuture)3 Executor (java.util.concurrent.Executor)3 Gson (com.google.gson.Gson)2 GeometryModelTextureTable (gg.moonflower.pollen.pinwheel.api.common.texture.GeometryModelTextureTable)2 java.util (java.util)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Minecraft (net.minecraft.client.Minecraft)2 Stopwatch (com.google.common.base.Stopwatch)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 JsonParseException (com.google.gson.JsonParseException)1 BufferBuilder (com.mojang.blaze3d.vertex.BufferBuilder)1 VertexConsumer (com.mojang.blaze3d.vertex.VertexConsumer)1 Blueprint (com.teamabnormals.blueprint.core.Blueprint)1 DataUtil (com.teamabnormals.blueprint.core.util.DataUtil)1 ConfiguredModifier (com.teamabnormals.blueprint.core.util.modification.ConfiguredModifier)1