mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 07:37:10 +00:00
Fix not correctly enchanting books
This commit is contained in:
@@ -21,6 +21,7 @@ export function ItemTooltip({ id, tag, advanced, offset = [0, 0], swap }: Props)
|
||||
const name = displayName ? JSON.parse(displayName) : (translatedName ?? fakeTranslation(id))
|
||||
|
||||
const maxDamage = MaxDamageItems.get(id)
|
||||
const enchantments = (id === 'minecraft:enchanted_book' ? tag?.StoredEnchantments : tag?.Enchantments) ?? []
|
||||
|
||||
return <div class="item-tooltip" style={offset && {
|
||||
left: (swap ? undefined : `${offset[0]}px`),
|
||||
@@ -28,7 +29,7 @@ export function ItemTooltip({ id, tag, advanced, offset = [0, 0], swap }: Props)
|
||||
top: `${offset[1]}px`,
|
||||
}}>
|
||||
<TextComponent component={name} base={{ color: 'white' }} />
|
||||
{tag?.Enchantments?.map(({ id, lvl }: { id: string, lvl: number }) => {
|
||||
{enchantments.map(({ id, lvl }: { id: string, lvl: number }) => {
|
||||
const ench = getEnchantmentData(id)
|
||||
const component: any[] = [{ translate: `enchantment.${id.replace(':', '.')}`, color: ench?.curse ? 'red' : 'gray' }]
|
||||
if (lvl !== 1 || ench?.maxLevel !== 1) {
|
||||
|
||||
@@ -25,6 +25,7 @@ export const LootTablePreview = ({ data }: PreviewProps) => {
|
||||
const state = JSON.stringify(table)
|
||||
useEffect(() => {
|
||||
const items = generateLootTable(table, { version, seed, luck, daytime, weather, stackMixer: mixItems ? 'container' : 'default' })
|
||||
console.log('Generated loot', items)
|
||||
setItems(items)
|
||||
}, [version, seed, luck, daytime, weather, mixItems, state])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user