#QIDB V3.9.0 | A database for saving ItemStacks without stringifying

1 messages · Page 2 of 1

edgy mulch
#

but very laggy

#

ill just stay with the old one

steep crystal
#

really?

edgy mulch
#

yea

#

i even try it in a new world

#

and compared to the old one

steep crystal
#

i tested it, it wasnt...

edgy mulch
#

and there should be an issue with the background saving

steep crystal
#

what's the lagging part?

edgy mulch
#

because i only save and get the items for kits

#

and i wasnt even getting anything

#

and the whole world was lagging

steep crystal
#

background saving is handled by runJob it should automatically adjust the rate

#

maybe i should optimize the firing of the runjob

edgy mulch
#

well not if one operation is very demanding

edgy mulch
#

when are you running runJob?

#

every tick?

steep crystal
#

runjob runs always, if there are no keysw it just doesnt do anything

edgy mulch
#

:u

steep crystal
#

but runjob run more than 50 times per tick

edgy mulch
#

damm thats really bad

steep crystal
#

yeah but for me it worked normally i didnt see any issues

edgy mulch
#

try running it maybe 1 per tick or 1 every 20 ticks

steep crystal
#

what are your specs

#

i run an i5-10400F + 16Gb 3600mhz

#

and it does not lag

edgy mulch
#

they are high, 32GB ram 3200mhz
i7-12700F

steep crystal
#

that's weird

edgy mulch
#

also its not the world ticking entity

#

its the runJob

steep crystal
#

so the ticking entity isnt doing anything bad?

edgy mulch
steep crystal
#
import { QIDB } from './QIDB.js'
import { world, system, ItemStack, Player } from '@minecraft/server';

const db = new QIDB('inventories', 270)


world.beforeEvents.chatSend.subscribe(e => {

    const { message } = e
    if (message != '.stress') return;
    else e.cancel = true

    system.run(() => {
        for (let i = 0; i < 10000; i++) {
            db.set(i.toFixed(0), new Array(255).fill(new ItemStack('dirt', 64), 0, 255))
        }
        world.sendMessage('END ____________________')

    })
})

that's the code i used to test

edgy mulch
#

wait look

steep crystal
#

try that same code and tell me if it lags

edgy mulch
#

@steep crystal

steep crystal
edgy mulch
#

During the test there is no lag XD

#

but once its over the lag returns

steep crystal
#

what ?!

#

i might have to do a deep debug

edgy mulch
#

yea that doesnt make any sense

#

look

#

wait

steep crystal
edgy mulch
#

should be the opposite

#

lol

steep crystal
#

average programming errors

#

why doesnt work | why does it work

#

this thread has reached 1k messages!!!

hazy sable
#

@steep crystal bro

#

the script is so heavy...?

#

QIDB

#

i was loosing my mind thinking it was one of my other addons

#

this was like 3 minutes

#

of profiler

#

just existing is what i gather

steep crystal
#

That’s therunJob, it works wrongly

steep crystal
steep crystal
#

Downgrade to 3.8.3

fleet root
hazy sable
empty breach
edgy mulch
#

It’s an incorrect use of the runJob

steep crystal
#

@edgy mulch on my pc i dont see any lag even with 7 databases

#

that's so strange

#

cpu usage doesnt change much

#

neither ram does go up

#
import { QIDB } from './QIDB.js'
import { world, system } from '@minecraft/server';


world.beforeEvents.chatSend.subscribe(e => {

    const { message } = e
    if (message != '.load') return;
    else e.cancel = true

    system.run(() => {
        for (let i = 0; i < 100; i++) {
            new QIDB(`db${i}`, 100)
        }
    })
})
#

@hazy sable idk how to fix this, this problem isnt a thing in my pc

#

i even tried with 10 addons at once and sill 0 lag

hazy sable
#

hmm

edgy mulch
#

like the saving part

#

im pretty sure you are not using it right

edgy mulch
#

avoid the while, and do a yield in the for loop

steep crystal
#

@edgy mulch you see, nothing goes wrong

icy oracle
# steep crystal

Do it with a Minecraft Debugger, even if you got +100 FPS, that doesnt means you got Full TPS

icy oracle
#

One tick only should take less 50ms

icy oracle
icy oracle
steep crystal
#

i know

#

lemme test rq

icy oracle
steep crystal
icy oracle
#

Good, but try it with a real minecraft debugger

steep crystal
#

runJob is meant for this

steep crystal
#
world.beforeEvents.chatSend.subscribe(e => {

    const { message } = e
    if (message != '.load') return;
    else e.cancel = true

    system.run(() => {
        for (let i = 0; i < 100; i++) {
            const db = new QIDB(`db${i}`, 100)
            db.set('a', new ItemStack('dirt', 64))
            db.has('a')
            db.get('a')
        }
    })
})

let lastDate = Date.now()
let tickspeed = 20;
system.runInterval(() => {
    let currDate = Date.now();
    let TPS = tickspeed * 50 / (currDate - lastDate) * 20
    lastDate = currDate
    world.getPlayers()[0].onScreenDisplay.setActionBar('TPS: ' + TPS.toFixed(2))
}, tickspeed
)

i just used that

icy oracle
#

like TPS, Script TPS etc

steep crystal
icy oracle
icy oracle
#

but you need a launcher file for it, read the docs about the extension

steep crystal
#
{
    "version": "0.3.0",
    "configurations": [
        {
            "type": "minecraft-js",
            "request": "attach",
            "name": "Debug with Minecraft",
            "mode": "listen",
            "preLaunchTask": "build",
            "targetModuleUuid": "3818803b-e5a0-4dd5-a8fb-48a1acaeb627",
            "localRoot": "${workspaceFolder}",
            "port": 19144
        }
    ]
}
icy oracle
#

alright

#

host is localhost

steep crystal
#

it says failed to start debug

icy oracle
#

I also got problems witth itt

#

i cant help you, it worked somewhen but well..

steep crystal
steep crystal
icy oracle
#

ye..

steep crystal
#

aint doing allat

#

there are 200 problems

icy oracle
#

Maybe ask in #1067535382285135923

steep crystal
#

and how do i get tps?

icy oracle
steep crystal
#

?

icy oracle
steep crystal
icy oracle
#

Its well running

steep crystal
icy oracle
#

good

#

HOW DID YOU MADE IT WORKING

steep crystal
#

so there isnt any problems?

steep crystal
#

in my pc and in LeGend077 ones the script works without issues

steep crystal
icy oracle
icy oracle
steep crystal
#

oh i just started the debug in listening mode, then i typed connect in minecraft and it connected

icy oracle
#

whats your launcher.json

steep crystal
#

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "minecraft-js",
            "request": "attach",
            "name": "Attach to Minecraft",
            "mode": "listen",
            "localRoot": "${workspaceFolder}/scripts",
            "port": 19144
        }
    ]
}
#

launch is in the .vscode

icy oracle
#

And what did you run on minecraft to connect it

steep crystal
icy oracle
steep crystal
icy oracle
#

well. idk why i get errors

steep crystal
steep crystal
icy oracle
#

i could easily connect it now

#

but minecraft throws tha one error each time

steep crystal
#

minecraft version?

icy oracle
#

1.21.62

steep crystal
#

btw the runJob works perfectly, it automatically adjust its rate when there is world lag

#

so even if it was very heavy it just wouldnt create any issues

icy oracle
#

ye

steep crystal
#

at this point idk what's wrong

#

oh maybe i found the issue

#

nvm

#

i foundn't

icy oracle
#

foundn't

empty breach
#

i am not seeing any issue here, if the lag you are concerned about is based on Leefy screenshot, you guys are reading reading things wrong

steep crystal
empty breach
#

no, the debugger telling you the total hang spike around the run duration
if i run a loop with 1000 iterations, and for each iteration the code spike 5 ms, the total will show as 5000ms for that loop

steep crystal
#

and also gameza said that the script was lagging in game while it was just a while (true) { yield; }
when there was the actual structure saving he was not experiencing lag

empty breach
#

didn't see any video here so idk

steep crystal
steep crystal
steep crystal
steep crystal
empty breach
steep crystal
#

the database was using the runjob

empty breach
steep crystal
empty breach
steep crystal
#

before doing /scriptevent the world was lagging,
after doing /scriptevent it saved 10 000 keys all at once,
the database handled that 10 000 keys with a runjob saving about 100 keys per second, while it was saving 100 keys per second the game was not lagging

steep crystal
#

and if it was the for the game would just freeze and crash

#

you see the issue?

empty breach
#

runJob run in queue
if the for loop is done that don't mean all the code it triggered is done too

steep crystal
steep crystal
#

set() function:

#

queueSaving function

#

database log

#

if its saying remaining: 10000 keys it means that queuedKeys are 10000 and this means that the queueSaving() method was called 10 000 times so the set actually ran 10 000 times

empty breach
#

what does his script run when reloading? sense the lag is only in reload

steep crystal
empty breach
#

only when reloading

steep crystal
#

no its all the time, and when he does the stress test the script stops lagging (the stress is supposed to create more lag)

edgy mulch
#

The reloading was to show the difference between the 2 databases

#

The old one and the new one

#

Reload doesn’t have anything to do with it, it will free memory

edgy mulch
# empty breach

@steep crystal also yea minato is right, i should have run that in another runJob with yield

#

I just copy and paste your code without thinking of it

#

But still that’s not the main issue

edgy mulch
#

@steep crystal the new beta works fine, here is the code snippet

system.afterEvents.scriptEventReceive.subscribe(({
    id
}) => {
    if (id === "idb:test")
        system.runJob((function* () {
            for (let i = 0; i < 10000; i++) {
                new ItemDatabase(`db${i}`, 100)
                yield;
            }
        })())
})
#

but still the old one performs better

#

ill show it in a bit

#

As you can see in the video, look at the TPS.

First im trying the new beta db, and it doesnt have any issues in idle state we can call it like that, but it kind of lags in this stress test, but just at the beggining!

In Second test, this doesnt seems like an issue, yea it drops but by -1 or -2 tps, there is a huge difference, in the first test we had a drop of -8 or -7 tps

#

the test was made with this code snippet

system.afterEvents.scriptEventReceive.subscribe(({
    id
}) => {
    if (id === "idb:test")
        system.runJob((function* () {
            for (let i = 0; i < 10000; i++) {
                const db = new ItemDatabase(`db${i}`, 100)
                yield;
                db.set('a', new ItemStack('dirt', 64))
                yield;
                db.has('a')
                yield;
                db.get('a')
                yield;
            }
        })())
})
#

and its lagging even tho im using yield; this could mean that the has, get or set method are a heave load

#

For now i will just stick with the old db for my projects

steep crystal
steep crystal
#

Like it needs to stress the game

edgy mulch
steep crystal
blazing crystal
steep crystal
#

In my pc it doesn’t create any problems if you see the debug it is perfectly fine

hybrid imp
#

@steep crystal how can i add the whole inventory to the database ?

hybrid imp
#

nvm

young river
steep crystal
#

@young river pin the Github first message, that is an old version

#

.

young river
tepid pollen
#

Carchi may I dm you?

steep crystal
steep crystal
#

QIDB V3.8.5 | A database for saving ItemStacks without stringifying

#

fixed all the lag issues, and added new logs and their options.
edited the readme to make it more undestandable.

changelog V3.8.5

  • added new logs option
  • added new log types
  • added back saverate
  • removed logs option (replaced by log options database.logs)
  • deleted runjob saving (lag issues)

https://github.com/Carchi777/QUICK-ITEM-DATABASE/releases/tag/V3.8.5

void shard
#

This is what I did with my Combat Mode 2.0 a few months ago, I've been meaning to fix a bug where entering and exiting a world sometimes won't give you the items back because the entity that stored the items probably disappears too quickly. Overall I like how we both have the same concept of storing stuff in entities and saving them with structures.

steep crystal
novel mural
steep crystal
novel mural
steep crystal
#

Yeah ive seen that they removed player leave and player join

novel mural
drifting granite
#

Everything seems to work for me in the new version

#

Saving/accessing items anyways

novel mural
drifting granite
#

I use the item database to save the item and use it to access it

#

I use an older version tho so I’m not sure about the newer ones

steep crystal
#

so basically it doesnt work becouse some functions like world.getDimension() has not priviledges

#

basically in the new update they just added world.afterEvents.worldLoad that basically the java public static void main function

steep crystal
# novel mural doesnt for me

the easiest quick fix is to wrap your script to setup the database in a system.run() or worldLoad

world.afterEvents.worldLoad.subscribe(() => {
    const db = new QIDB(`database`, 100, 2)
})


system.run(() => {
    const db = new QIDB(`database`, 100, 2)
})
steep crystal
#

im alredy doing a fix, but that means that you cant use database methods outside system.run or events

steep crystal
steep crystal
#

QIDB V3.8.6 | A database for saving ItemStacks without stringifying

drifting granite
#

Realised why mine worked. I use the method for using the “1.9.0-beta” api instead of 2.0 so nothing broke for me

#

Basically wrapping all my main imports like this

steep crystal
edgy mulch
edgy mulch
#

All you need is to make your own plugin loader if we can call it like that

edgy mulch
novel mural
steep crystal
fleet root
rose forge
#

anybody can help me to make backpack entity? is basicly entity shulket box with 65 slots

rose forge
steep crystal
#

“Idk” what? What’s the problem with your shulker?

rose forge
steep crystal
empty breach
#

?

#

don't ping without context

steep crystal
#

?

#

what

#

wdym by when the entity is reloaded?

#

what is that entity

#

i dont get what's the problem

#

show the script

#

try using quick memory access not set to 0

#

forget it

#

maybe its a world loading issue

#

what's that

#

thanks for reporting the issue

#

ill make an update asap

empty breach
#

don't you love it when someone report a bug and solve it himself

steep crystal
empty breach
#

yeah, testing across devices is time consuming

steep crystal
#

QIDB V3.8.7 | A database for saving ItemStacks without stringifying

junior jackal
#

YIPPE new update

steep crystal
#

I just changed 1 line of the entity json 😭

fleet root
#

lol

junior jackal
#

i know, i saw it

cerulean forge
#

How do you get those nice screenshots

dapper plover
prisma roost
cerulean forge
#

Okk

urban pagoda
elder otter
sturdy raptor
#

I like the fancy screenshots for showcasing code, because sometimes its nicer to have it in an image, e.g. forum post thumbnails. Every other time its much better to use code blocks.

steep crystal
#

255

steep crystal
#

If inv size is 255 or less it will work fine

steep crystal
#

NEW UPDATE COMING TOMORROW

  • new max size 1024 ItemStack per key.
  • new times to load
    Tested on:
    CPU: I5-10400F 4.30 Ghz (Desktop)
    RAM: Kingston fury beast 2x8Gb DDR4 3600mhz
    SSD: GigaByte nvme m.2 2280, 1 TeraByte
    Without cache memory
 256   values in 1 key      5 ms avg
 512   values in 1 key     10 ms avg
 768   values in 1 key     16 ms avg
1024   values in 1 key     21 ms avg
steep crystal
drifting granite
steep crystal
#

i cant use 2048 becouse it will take 1 entire tick to set/get a value

drifting granite
#

Still not bad

steep crystal
#

304 ms to queue the world saving for
1024000 ItemStacks

#

it totally takes 2/3 minutes to fully save them in the world

steep crystal
#

QIDB V3.9.0 | A database for saving ItemStacks without stringifying

junior jackal
#

Is it more than one line now 😆

magic mirage
#

Can anyone explain to me this pls

elder otter
#

this is a database to store ItemStack instances in a easy without using JSON.stringify

#

it does provide also a caching system

steep crystal
# magic mirage Can anyone explain to me this pls

Basically this is a class i've made becouse script API doesn't have something reliable to store items, i initially needed this for my backpack addon, becouse you cant store items into an item, so i made this database to link items to my backpack.

This is a database for saving itemstacks as NBT data becouse it uses structures, you can save things like shulkerboxes saving also their content. This is useful for like a server item shop where players can buy and sell their items, you can create backpacks that work like real inventories..

steep crystal
magic mirage
#

Also this creation seems awesome

steep crystal
#

you can save a player inventory like this:

const database = new QIDB("inventories")
database.set("PlayerInventory", [ item1, item2, item3...]) 

where inventories is the namespace of the database, and PlayerInventory is the identifier linked to the items

magic mirage
#

Oh yeah this sounds very useful for map makers and server hosters

cerulean forge
#

this could be a life saver for synchronisation

#

@steep crystal can you connect this to multiple bds instances, or is it local to a behavior pack ?

empty breach
#

local

cerulean forge
#

That's sad

#

I should create something for synchronisation

steep crystal
#

It’s Made to work for addons also

#

That has nothing online, since you can use thing online only in bds

steep crystal
lofty sail
#

I'll just stick with what I have, thanks

junior jackal
#

@steep crystal did you ever complete your backpack add-on? Basically im passing the player's hot bar inventory to the database inventory when mounting an entity. Basically i just want to access the entity's inventory, something similar on how a back-pack would work.

steep crystal
steep crystal
steep crystal
junior jackal
#

@steep crystal that's is actually really cool how thats works. But how can I view the database storage that I transferred my items too?

#

Do I have to spawn the storage entity in front of the player?

steep crystal
#

what?

drifting granite
#

He’s asking how to retrieve stored items

steep crystal
#
const key = player.id + "_backpack" 
// you can use whatever you want this is just an example of key
const items = database.has(key) ? database.get(key) : [];
#

the database automatically does it

#

it automatically spawns the entity and gets the items

junior jackal
#

Okay nice let me try it out

steep crystal
#

import { QIDB } from "./QIDB.js";

const Backpacks = new QIDB("Backpacks", 10, 1)

function getBackpackItems(backpackId) {
    return Backpacks.has(backpackId) ? Backpacks.get(backpackId) : []
}

function updateBackPackItems(backpackId, newItems) {
    Backpacks.set(backpackId, newItems)
}

rotund plaza
#

I've made a TypeScript version of this database in case someone is using that.

It's not exactly the same; it's a bit more strict on what you can do:

  • You must have a namespace
  • The return type for get is only ItemStack[], not single ItemStack instances

The intellisense comments will also tell you more about what's happening in the background.

https://github.com/Aevarkan/item-database

Also linked on the first message #1252014916496527380 message.

GitHub

An ItemStack database for Minecraft: Bedrock Edition's Script API. - Aevarkan/item-database

steep crystal
distant portal
steep crystal
#

but why do you need to send the message here

somber wagon
distant portal
#

Right

fleet root
#

bruh

sturdy raptor
#

and uve been doing this in a couple of these threads

distant portal
sturdy raptor
#

just posting a link is still promoting no matter what u say. dont promote ur lib in other peoples threads

fleet root
steep crystal
#

who pinged me and deleted the message?

radiant ocean
#

and multiple inventory saves for multiple players

steep crystal
steep crystal
radiant ocean
#

maybe my 1st question is my bad at coding, but can you explain the 2nd question

#

i managed to fixed my kit editor code! This db is the best!!!

#

ill test more if that supports multiplayer as well

steep crystal
# radiant ocean can i ask you some questions if you dont mind: 1. how can you save the armor slo...

1 the database just saves items it’s up to you to get the items and give them to the database, you have the 256 slots on a key you can add the 36 inventory slots and also get the 5 equippable slots after the 36th

2 the limit is 30 becouse I’m using Minecraft structures to save items since it’s the most efficient reliable and keeps all the data in the items and Minecraft uses a 30 character limit on structure ids

steep crystal
radiant ocean
#

so if i understand it right, i can have unlimited players, each having unlimited kits (inventories saved), as long as each kit is under 36 slots limit of total items right

steep crystal
radiant ocean
#

alr ill do more test bout that. thanks

steep crystal
radiant ocean
#

this saves lots of time for me doing the kit editor stuff

rotund plaza
#

Is there a reason you're setting the dynamic property to null instead of undefined to remove them? Update 1.21.40 had this in the changelog:

  • Removed function removeDynamicProperty - Please use setDynamicProperty with a value of undefined to remove a property
    Has there been a change I'm not aware of?
fleet root
hollow nymph
#

@steep crystal Hi, is there any way to avoid using the ticking area in the database? For example, using the spawn area.

steep crystal
halcyon island
#

Im wondering which I should use

steep crystal
# halcyon island Im wondering which I should use

my database (even Aevarkan's version) work with

+ structures: They dont impact the in real time performance becouse are saved into your drive and not RAM.

+ uses entities with 256 slots, keys have Array values so it can handle 1024 different itemStacks per key (4 entities per key).

+ more control on cache management

+ more control on saving speed

- doesnt save metadata for the item, you'll have to do it by yourself with dynamic properties or itemStack lore.

smell of curry's database:

+ you can set your metadata of the items easily

- doesnt use structures, entities are always loaded in the world increasing constant ram and cpu usage.

- uses entities with 200 slots and each key is paired with only 1 item, so you'll end up calling lot of times the database (not efficient).
urban pagoda
steep crystal
#

also 35 people liked the post so i think someone there is

rotund plaza
#

It's going to be very useful for storing items to rollback (like how you can do in Core Protect). That's what I'm currently working on, and the reason I made a TypeScript version.

urban pagoda
#

or isnt this metadata?

steep crystal
urban pagoda
#

whats metadata in items

steep crystal
#

metadata is the data for like shops or auctions where you put the price, the seller name and the date where you put the item

urban pagoda
steep crystal
#

that's something different

#

you cant link a dynamic property to an item that can have more than 1 item in the stack

rotund plaza
urban pagoda
#

btw in the future if someone asks simple questions avoid answering in a passive aggressive way please

steep crystal
rotund plaza
#

Since you're here, I do have a question: how come you're using async?

steep crystal
#

35% of the current database is wrote like garbage when i was beginner but it works so i never changed it

rotund plaza
#

If it doesn't break, I'll remove the async since it's preventing me from running a structure command.

steep crystal
#

i think ill have to completely remove it its just useless doesnt do anything

urban pagoda
urban pagoda
steep crystal
#

maybe we re just trying to say the same thing in 2 different ways

urban pagoda
#

youre contradicting yourself so probably

steep crystal
#

i was just saying that
item.setDynamicProperty() is wrong becouse the stack size limit
but
world.setDynamicProperty("item_X:metadata") is rightg

urban pagoda
# steep crystal where?

you said that dp is something different than metadata but then said dynamic properties are a way to store metadata

steep crystal
halcyon island
# steep crystal my database (even Aevarkan's version) work with ```diff + structures: They dont...

Okay, structures are interesting. I am going to ask him about that.

Also, why did you use 256 slots in the entity's inventory component? What is the true max?

His DB saves instantly so wdum more control on save speed?

Also, what do you mean each key is only paired with 1 item? Let's say you have an item saved to a key like some-cool-item, you call the DB to retrieve that item, and the DB:

  1. Checks the cache to see which entityId stores that itemId
  2. Fetches the item from that entity and returns it.

How is that not efficient?

steep crystal
halcyon island
halcyon island
#

Also, wouldn't loading in a structure to fetch an item, then loading it out later to be loaded in again, be inefficient as in a server that is fetching items every second that would be a lot of unnecessary calls to the structure API?

But structure managment would be good in a backup sense

steep crystal
steep crystal
# halcyon island Yeah I am confused how its 200x more performance. heavy?

couse for saving 200 items in my database is

const items = [itemStack........ x200]
db.set("my_items", items) // this runs 1 time

saving 200 items in the other database is

const items = [itemStack........ x200]
for (let i = 0; i < 200; i++) {
    db.addItem(`item_${i}`,items[i]) // this runs 200 times
}
hollow nymph
steep crystal
hollow nymph
halcyon island
#

interesting, so you store a key->items relationship not a key->item

rotund plaza
#

Were you using any of the dynamic property values? I can't find any getDynamicProperty calls that actually use the value.

I only found

if (world.getDynamicProperty(key)) { this.#quickAccess.set(key, items); return items }
else { this.#quickAccess.set(key, items[0]); return items[0]; }

which I replaced with

this.quickAccess.set(fullKey, items)
return items

Was that just for returning a singleton versus an array?

Apologies if this feels overly critical, but I need to know how the database works before I can use it in my add-on.

steep crystal
#

Yeah if you set the value not using an array it will end up returning the item without array with the .get method

rotund plaza
#

I see, in that case I won't add that functionality back into my version.

Having it return both arrays and singletons is too confusing.

steep crystal
rotund plaza
#

I only saw getDynamicProperty inside the get method. I didn't see the values being used elsewhere. The properties themselves I still have, but only the keys are used.

steep crystal
rotund plaza
#

Yes, setDynamicProperty, but I didn't see anywhere else getDynamicProperty was being used.

#

Doesn't it spawn the entities by counting the length of the array? And then spawns more if it's larger than 256.

empty breach
#

Anyone tried apply impulse in the new preview?

empty breach
steep crystal
rotund plaza
# steep crystal honestly its 3 months that im not touching the code i dont remember, all the cod...

I did rewrite quite a lot of it for my version. There aren't that many functional changes - I mostly added documentation to all the different methods so it'd be less confusing for me to use.

https://github.com/Aevarkan/item-database/releases/tag/v1.0.0

GitHub

Initial Stable Release
This is the first release, forked from QUICK-ITEM-DATABASE v3.9.0.
This is a stable release with no expected breaking changes.

Compatible with 2.x.x scripts
1.x.x scripts ha...

#

I could make a pull request from mine if you'd like, but I'll have to fork the original JavaScript version so there won't be too big of a diff - unless if you're fine with a really big diff.

radiant ocean
#

are there any differences between v3.9.0 and aevarkan's one

rotund plaza
#

The changes that are there include:

  • return type for get is an array only, not single instances
  • namespace has more restrictions
  • scoreboard is not used (that's why there's a namespace restriction)

Basically stuff that makes it more compatible with other add-ons. If you're not using it for something major, there won't really be a difference.

Since I'm using it for an add-on that has major effects on a world, it has to be safe (by either limiting global pollution, or by clearly documenting all side effects). That's why I made my version in the first place.

hollow nymph
#

Hello,
Approximately how many items and how many different keys can I create in the database without causing lag or errors? @steep crystal

steep crystal
#

the lag is just opening the world that will take a while after too much items

hollow nymph
hollow nymph
steep crystal
#

it isnt

edgy mulch
#

because the world wont start if it takes too much time

#

the best you can do is limit the data or delete the old data

hollow nymph
hollow nymph
edgy mulch
#

:D.

small ingot
#

@steep crystal hey can using qidb in two seperate addons cause items to vanish, the items from 1 addon remains after start but from the other, it vanishes after restart

steep crystal
small ingot
#

Yes

#

That's the reason?

steep crystal
small ingot
#

Ok

rose forge
#

@steep crystal how i can use this for anything? like saving for players with 2 diffrent saves, entity saves

#

also it is lattest-beta or lattest?

steep crystal
steep crystal
#

if its about the version i honestly dont even know i dint touch that for 5 months

rose forge
#

also i m thinking to do for backpack entity

steep crystal
steep crystal
#

i think idk i didnt test but should if there arent no major changes

rose forge
rose forge
#

two diffrent items saves

#

skygen and survival

#

beause using custom private shulker entities looks amazing but when someone doesnt read command blocks has go back to lobby (clears inv) all items are rip

#

i dont know how this works too

#

@steep crystal

novel mural
#

It should work

#

@rose forge

rose forge
#

also how this work and how i can use for 2 inventory saves like skygen save survival save

rose forge
#

@steep crystal @novel mural script is broken
Compiler found 4 errors:

QIDB.js:47:36 - error TS2339: Property 'isOp' does not exist on type 'Player'.

47                         if (player.isOp) {
                                      ~~~~

``````ansi
QIDB.js:171:19 - error TS2304: Cannot find name 'Container'.

171         /**@type {Container[]} */
                      ~~~~~~~~~

``````ansi
QIDB.js:194:92 - error TS2322: Type '"World"' is not assignable to type 'StructureSaveMode'.

194         world.structureManager.createFromWorld(key, this.#dimension, this.#sL, this.#sL, { saveMode: "World", includeEntities: true });
                                                                                               ~~~~~~~~

  @minecraft/server.d.ts:21538:5
    21538     saveMode?: StructureSaveMode;
              ~~~~~~~~
    The expected type comes from property 'saveMode' which is declared here on type 'StructureCreateOptions'

``````ansi
QIDB.js:334:9 - error TS2322: Type '(ItemStack | ItemStack[])[]' is not assignable to type 'ItemStack[][]'.
  Type 'ItemStack | ItemStack[]' is not assignable to type 'ItemStack[]'.
    Type 'ItemStack' is missing the following properties from type 'ItemStack[]': entries, keys, values, includes, and 35 more.

334         return values;
            ~~~~~~

novel mural
#

Just dm me, don't flood here :/

elder otter
elder otter
rose forge
elder otter
novel mural
rotund plaza
# rose forge i tried new version on 2.20-beta

I did make a TypeScript version a while back, although I'm not sure if it'll be error free for 2.2.0-beta. The logic doesn't really change much, it's just more explicit. There are minor changes though. I removed that isOp completely from my version.

#1252014916496527380 message

#

I've just checked on 2.2.0-beta.1.21.102-stable, and the only errors were coming from // @ts-expect-error. You can safely remove that; I put those two lines there in the first place to suppress an error popping up in a different version.

rose forge
rose forge
#

oh it is type script nevermind

#

i going to remove isop thing

rotund plaza
faint grotto
steep crystal
#

if it is the first time at least 1 player needs to be valid in the world for the db to start

#

if it isnt the first time just wait for the world to load

#

@faint grotto

faint grotto
#

In the world there is a command block command that runs before the db and causes the data to be deleted, I make sure to accept the command only after 3 seconds of the world loading, to be sure

#

@steep crystal

steep crystal
#

Ok

worldly tendon
#

Hi @steep crystal do you know why this error occurs

[Scripting][inform]-§aQIDB > Set key PlayerShop:Plund_mgeyo28y succesfully. 2ms §r10/06/2025, 10:01:23.556 AM

[Scripting][inform]-§eQIDB > Saving, Dont close the world.
§r[Stats]-§eRemaining: 1 keys | speed: NaN keys/s §r10/06/2025, 10:01:23.726 AM

[Scripting][inform]-1

[Scripting][error]-Unhandled promise rejection: InvalidArgumentError: Invalid value passed to argument [0]. 'qidb:storage' is not a valid entity type. at #load (db/QIDB.js:167)
at #romSave (db/QIDB.js:204)
at <anonymous> (db/QIDB.js:110)

[Scripting][inform]-§aQIDB >Saved, You can now close the world safely. §r10/06/2025, 10:01:23.745 AM

steep crystal
rose forge
#

This script needs bug fixes

hazy sable
#

I use an older modified version of this addon, workss great!

junior jackal
#

Definitely needs to be updated. I've been updating it on my own

steep crystal
#

You guys can fork the github and share it here to make it work better

fleet root
rotund plaza
#

From just checking with the latest npm packages, I didn't see any new errors pop up in regards to before.

I don't believe any update has broken this, unless if it's breaking in-game (I didn't check in-game). I've only checked my fork, however.

rose forge
#

anyone does have javascript version?

humble hatch
#

how do i fix this? 😭

#

tried adding system.run

hazy sable
#

you need to import the full script in the worldLoad

#

from another file is easier

humble hatch
grave swan
fiery field
#

do i have to handle, when a certain item (parent key) is deleted from world to delete from the database? Or is it already covered by this @steep crystal ?

Like for example, a backpack item that holds a parent key with dynamic property. When this backpack item is destroyed either from fire, lava, cactus, explosions, etc.

Since I'm concern if let's say i have a 500+ backpack item which has an individual items saved from this database, and without garbage collection which could affect the performance of the game.

#

Great package, btw. I'm using it rn with my big project

#

Just need to clarify some stuffs, if should I implement this, or is this technically not a problem for performance in the long run.

Cause, if it's not really a problem, then I'll probably waste some time trying to implement the edge cases.

steep crystal
#

the parent key you re refering to isnt an object, its linked to a string (sequence of characters)
its like the difference between Map and WeakMap, and in this case the database works like a map

fiery field
#

Ah okay, got it. Thank you @steep crystal for this.

astral mica
steep crystal
#

but i think i'll rebuild it from zero with the skills i currently have, couse i made this when i was a beginner

#

i think i'll make this as a separate pack to dowload to handle all the dependencies

#

to avoid pack data conflicts

astral mica
hazy sable
#

U should be fine

hazy stirrup
#

where the latest?