#fixing backpack

1 messages · Page 1 of 1 (latest)

humble sparrow
#

@echo swallow

echo swallow
#

so what isn't working?

humble sparrow
#

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

echo swallow
#

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?

humble sparrow
echo swallow
#

ok, how do you tell backpack items apart?

humble sparrow
#

i used a JSON.stringify(backpackItems) where backpack items are a list of items, amount,slot

echo swallow
#

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?

humble sparrow
#

backpack item? you mean backpack item in sense of hotbar backpack?

echo swallow
#

didn't you say you get the player's held item?

humble sparrow
#

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

echo swallow
#

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
humble sparrow
#

If I switch from backpack 1 to backpack 2 the held item id is still btm:backpack

echo swallow
#

ok you said a player can have multiple back packs right? how do you know which lore to use?

echo swallow
humble sparrow
humble sparrow
#

Wait can I set dynamic proprieties to items?

echo swallow
#

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

echo swallow
#

nope, it's released, it is stable now

echo swallow
humble sparrow
#

so i have to set aganin and again backpack to player?

humble sparrow
#

it doesnt work

humble sparrow
humble sparrow
#

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

echo swallow
odd hull
#

did you get this to work?

humble sparrow
odd hull
#

thats a lot xD

humble sparrow
odd hull
#

i was going through your code, basically it spawns the entity in front of the player right?

#

or how exactly is it done?

humble sparrow
odd hull
#

what happens once the player is off the inventory screen?

humble sparrow
odd hull
#

can i see your entity behavior?

humble sparrow
humble sparrow
odd hull
#

oh i understtand now

odd hull
#

because of the limits to the lore right?

humble sparrow
#

but i was creating something to hold all items

odd hull
#

hmmm

#

okay if you figure it out, let me know

humble sparrow
#

thats the item db im working on'

odd hull
#

i love the notes 🙂

humble sparrow
#

this can save, and load items

humble sparrow
#

notes are made by chatgpt btw

odd hull
#

oh are they?

#

well thats good, easy to read the functions

humble sparrow
odd hull
humble sparrow
#

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

humble sparrow
odd hull
#

alr sounds good

humble sparrow
#

and testing if i can add more slot to entity

odd hull
#

More!

#

???

humble sparrow
#

you think 99999 is ok? i was thinking if someone needs to do this on a server

odd hull
#

oh i see

humble sparrow
#

this can hold up to 3333 backpacks that are 30 slots each

#

33thousand backpacks works

humble sparrow
#

the other ones i think they work just as fine

mental bolt
#

Nah what a bad backpack system...

humble sparrow
mental bolt
#

You dont save the actual item, just the typeId and amount, you lose every other property/component lol

humble sparrow
#

and i did the store system

mental bolt
#

I see

#

thats good then

#

an entity item db

#

that can save the actual item

humble sparrow
#

yeah and it has 999999 slots so you wont get storage size issues

azure osprey
#

?

#

Wth

sharp stirrup
humble sparrow
sharp stirrup
#

entity name is** lekoji:upgraded_shulker**

humble sparrow
humble sparrow
sharp stirrup
humble sparrow
#

What?

sharp stirrup
#

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

humble sparrow
sharp stirrup
humble sparrow
#

but you can link it to an item

sharp stirrup
#

threes a add-on did

#

backpack entity system saves inside item

humble sparrow
#

then if you want to get the backpack's items you just get the ID from the dynamic property and get the linked key

sharp stirrup
humble sparrow
sharp stirrup
humble sparrow
craggy karma
#

How to place a block at certain coordinates