Skip to content

Bug & Performance issue#67

Description

@hechang27-sprt

Issue type:

  • 馃悰 Bug
/// <reference path="../integratedscripting.d.ts" />

/**
 * 
 * @param {import("../../integratedscripting").ValueItemstack} item
 * @param {number} level  
 */
function filterEnchantLevel(level, item) {
    const nbtPath = `["minecraft:enchantments"].levels[?(@ >= ${level})]`;
    const levelsNbt = idContext.ops.stringNbtPathMatchFirst(nbtPath, item.nbt());
    
    let levelsList = [];
    // I have to do this weird hack to convert it to list
    // `idContext.ops.nbtAsIntList` doesn't work here, producing an empty list 
    // `levelsNbt` can be null at times, without null filtering, it causes errors and massive lags when used to filter loot from mob farm  
    if (levelsNbt && Array.isArray(levelsNbt)) {
        levelsList = [...levelsNbt]
    }
    return levelsList.length > 0;
}

Short description:

Steps to reproduce the problem:

  1. Setup the script terminal, connect the function with a variable card, then apply a number to the variable card to get a filter operator
  2. Use the operator to filter on an item interface connected to a functional storage armoury cabinet filtering large stream of items
  3. The bug occurs. The average tps doesn't get affected much but there is consistent lag spike every a few second or so.

Expected behaviour:


Versions:

  • This mod: integrateddynamics (v1.33.4), cyclopscore (v1.29.2), integratedtunnels (v1.9.4) integratedscripting 1.0.24
  • Minecraft: The detected Minecraft version is "1.21.1".
  • Mod loader version: The platform is a NeoForge server running version "21.1.247".
  • ATM10 7.3

Log file: I kinda don't wanna share the spark profile publicly due to the lack of anonymization, I hope this flamegraph helps:

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions