#Help with getting enchantment type and level
1 messages · Page 1 of 1 (latest)
Try with e.level
JSON.stringify(enchantable.getEnchantments())
Log this?
ye...
I get issues with these too
const level = enchantmentsLevel ?? 0;
const drop = drops.drops[level];
const amount = Math.random() * (drop.max - drop.min) + drop.min;```
[null, null]
So there is no way to get level of an enchantment?
const enchantmentsLevel = item.getComponent("minecraft:enchantable").getEnchantments().map((e) => e.level);``` I log this and it returns `[3, 1]`
strange
I think because of this, the drops tries to check for both in the min and max values
I think I need that [0] (idk what's the term) to only return the first value
But I think it should return only the current value, right?
Oh.. it returns all enchanted levles
Lollllllll
Darn... I don't know how to get level of fortune then
item components are null in non-beta stable
I use beta apis

[].map(e => e.type.id)
Yea my peanut brain is not functioning right now
always have visuals, i tell ya
Wait, do you want just the fortune enchantment?
Yea
.getEnchantment...
I need to pass fortune's enchantment levels into drops to calculate how many items to drop based on fortune's level
That got removed iirc
this still works
const level = enchantments.getEnchantment( "fortune" )?.level ?? 0;```
;-;
item.getComponent("enchantable").getEnchantment("fortune")
item.getComponent("minecraft:enchantable").getEnchantment( "fortune" )?.level ?? 0```
This worked 😔 I hate when it tells me it won't work and then it decided to work
let the brain cook smh