From e2ba70cdac3b26a6e631c7fe2b997aff21489e6e Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 12 May 2023 01:00:32 +0200 Subject: [PATCH] Fix #367 Round constant number providers --- src/app/components/previews/LootTable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/previews/LootTable.ts b/src/app/components/previews/LootTable.ts index 3ed6bb99..6315178b 100644 --- a/src/app/components/previews/LootTable.ts +++ b/src/app/components/previews/LootTable.ts @@ -1,8 +1,8 @@ import type { Random } from 'deepslate/core' import { Enchantment, Identifier, ItemStack, LegacyRandom } from 'deepslate/core' import { NbtCompound, NbtInt, NbtList, NbtShort, NbtString, NbtTag, NbtType } from 'deepslate/nbt' -import type { VersionId } from '../../services/Schemas.js' import { clamp, getWeightedRandom, isObject } from '../../Utils.js' +import type { VersionId } from '../../services/Schemas.js' export interface SlottedItem { slot: number, @@ -460,7 +460,7 @@ const LootConditions: Record LootCondition> = { } function computeInt(provider: any, ctx: LootContext): number { - if (typeof provider === 'number') return provider + if (typeof provider === 'number') return Math.round(provider) if (!isObject(provider)) return 0 const type = provider.type?.replace(/^minecraft:/, '') ?? 'uniform'