#how to set item lock when im using and unlock when im not using
1 messages · Page 1 of 1 (latest)
uh
check for item use on event
and grab the item stack
from there modify the item stack's item lock
are you using item stop charge as an event?
i still dont see why u even need this
so basically when you stop interacting with the item it sets a lore?
i'm so confused
wait
ill tell
world.events.beforeItemUse.subscribe(({ source, item }) => {
item.lockMode = ItemLockMode.item;
});
world.events.itemStopCharge.subscribe(({ source, itemStack }) => {
itemStack.lockMode = ItemLockMode.slot;
});
@left citrus
let me see
lmfao
it says item.lockMode = ItemLockMode.item;
doesnt work
Native setter cannot be undefined
item.lockMode = ItemLockMode.item;
i gotcchu
world.events.beforeItemUse.subscribe(({ source, item }) => {
item.lockMode = ItemLockMode.slot;
});
world.events.itemStopCharge.subscribe(({ source, itemStack }) => {
itemStack.lockMode = ItemLockMode.none;
});
are they flipped?
so you want it to unlock when you stop holding right
yes
i just switched itemlockmode
to none
ans when you use the item it sets it to slot lock
i can't test rn but that should be it tbh
could be that the event itemstopcharge only works for chargable items like bows and crossbows
but i don't know
can you try debugging it
kk
this should work tho that is really weird
@jagged zephyr sorry to bother but m9 do u think you could help us with this?
I'm not home rn so i can't really do any debugging
if i dont use it
people can drop the item and the lore can be set which generates a new item
define 'using'
does it have a cooldown?
no cooldown
world.events.beforeItemUse.subscribe(({ source, item }) => {
item.lockMode = ItemLockMode.slot;
});
world.events.itemStopCharge.subscribe(({ source, itemStack }) => {
itemStack.lockMode = ItemLockMode.none;
});
i tried to use this but it didnt unlock the item
what's the item's components like?
"minecraft:food": {
"nutrition": 0,
"saturation_modifier": "supernatural",
"cooldown_type": "chorusfruit",
"cooldown_time": 0,
"can_always_eat": true
},
"minecraft:hand_equipped": true,
"minecraft:use_duration": 99999,
y do u have tha use duration so long
ok, and what's the purpose of locking that item again?
cuz when i stop using the item i setlore
if the player uses the item
and drops the item by mistake
the item falls
and another item gets generated
i can send that part of the code to u in dms lol
what's the lore for?
cant u juts setLore on item Use?
if i do that the fire rate gets lower
ah