#fixing backpack
1 messages · Page 1 of 1 (latest)
so what isn't working?
when i switch from a backpack to another directly it saves items in the other backopack
so i was thinking what can i do to make it respawn the entity when switching from backpack to another
how does this “backpack system” work?
so you want the backpack entity to despawn if the player isn't holding a backpack, but it doesn't if you hold another?
backpack entity needs to despawn if backpack isnt the same
ok, how do you tell backpack items apart?
wdym
i used a JSON.stringify(backpackItems) where backpack items are a list of items, amount,slot
if you have backpack item number 1 and backpack item number 2 in your hotbar, how do you know which one are you holding to spawn the correct entity?
backpack item? you mean backpack item in sense of hotbar backpack?
didn't you say you get the player's held item?
it looks if player is holding a backpack then it spawns the entity then it checks the lore
then with the lore it gets the items to set in the entity
does it work like this:
- if heldItem is backpack -> spawn entity
- get lore, convert it to items, give it to the entity
- tp the entity and update the lore
- if heldItem is not backpack -> despawn entity
That’s how it works for now
If I switch from backpack 1 to backpack 2 the held item id is still btm:backpack
ok you said a player can have multiple back packs right? how do you know which lore to use?
how about this: why not using item dynamic properties to store the items inside the backpack item itself?
It gets the lore of the backpack then it gives the dynamic prop that is named as the lore of the item, then it takes the items from propriety then it loads it into entity
I am stupid you re right
Wait can I set dynamic proprieties to items?
this way you don't have to match the item with the correct player anymore, and you can give the backpack to other players and they can still use it
yes, but i think it's still beta api
nope, it's released, it is stable now
but make sure to set the item back to the player, otherwise your changes are going to get lost
so i have to set aganin and again backpack to player?
it doesnt work
the problem is not that, the problem is that when you change item i dont know why it saves them in the other bakpack
finally i fixed it
i just needed to check if player has changed item and if it has then it blocks the save funcion
so it wont save it in another backpack
glad it works
did you get this to work?
wait lemme chech my addon
thats a lot xD
also an entoty
i was going through your code, basically it spawns the entity in front of the player right?
or how exactly is it done?
yeah becouse this works in multiplayer, and saves multiple backpack
what happens once the player is off the inventory screen?
yeah so you can open it easily, its an invisible entity and its little and spawns in player head so other players cant open your backpack
can i see your entity behavior?
nothing it just spawns the entity when you are holding the backpack and it gets the backpack lore so it can get the id of the backpack and give the items
this backpack has an huge problem, it doesnt save items enchantments
oh i understtand now
oh darn
because of the limits to the lore right?
yeah
but i was creating something to hold all items
i love the notes 🙂
this can save, and load items
i was thinking of post it on resurces
notes are made by chatgpt btw
yeah i wasnt gonna do it for all functions
so is this ready? Or are you still working on it?
this can store up to 99999 items and you can load/save items everywhere you are, it also saves item as an itemstack object so you wont loose anything
just need to test the spawn thing at the start
alr sounds good
and testing if i can add more slot to entity
you think 99999 is ok? i was thinking if someone needs to do this on a server
oh i see
this can hold up to 3333 backpacks that are 30 slots each
33thousand backpacks works
finished it it works fine for addItem and getItem #1252014916496527380
the other ones i think they work just as fine
Nah what a bad backpack system...
what you suggest
You dont save the actual item, just the typeId and amount, you lose every other property/component lol
yeah thats why i said that i was working to save the item as an itemstack and not as a dynamic property
and i did the store system
yeah and it has 999999 slots so you wont get storage size issues
this does works? and saves with echnats lore NBT data?
That script is very old...
It works in the latest version
and yes it saves all with NBT you can even save enchanted items in a shulkerbox in this database
#1252014916496527380 https://github.com/Carchi777/QUICK-ITEM-DATABASE
in 1.21.60 ?
but i want when entity gets hit or dies drop own spawning egg or item like backpack etc. and players spawns entity and inventory still inside an saves entity color nametag also i dont want save as name they can exploit this i want make ID save not nametag save
entity name is** lekoji:upgraded_shulker**
it works in 1.20.60 but i meant In the last version of the database
This is an item database not a backpack
i m suck at main.js
What?
bacily on entity killed, saves data stored at a item if player places again an inventory , nametag , color will back
it is like shulker box but is a entity
but large stroge
i will back in 20 mins wait
Yeah you can use that database to store the backpack items when you kill the backpack or spawn it
but how i can save inside in item?
you cant save inside an item
but you can link it to an item
i mean this
threes a add-on did
backpack entity system saves inside item
you can set an unique ID in the backpack (item) DynamicProperty, and in the database set a key that has the same ID as the backpack (item)
then if you want to get the backpack's items you just get the ID from the dynamic property and get the linked key
how i can code ? i m bad at script api
Visual Studio Code is the best option
i dont have any time to use pc and visual studio doesnt downloading
i donk know then how you can do it
you can use bridge web app https://editor.bridge-core.app/
How to place a block at certain coordinates