9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-06 15:52:03 +00:00

fix uniform number

This commit is contained in:
XiaoMoMi
2025-03-15 17:52:16 +08:00
parent e1683b422e
commit 24f9ed9644
4 changed files with 5 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ public class SetCountFunction<T> extends AbstractLootConditionalFunction<T> {
@Override
public LootFunction<A> create(Map<String, Object> arguments) {
Object value = arguments.get("count");
boolean add = (boolean) arguments.getOrDefault("add", true);
boolean add = (boolean) arguments.getOrDefault("add", false);
List<LootCondition> conditions = Optional.ofNullable(arguments.get("conditions"))
.map(it -> LootConditions.fromMapList((List<Map<String, Object>>) it))
.orElse(Collections.emptyList());

View File

@@ -17,7 +17,7 @@ public class UniformNumberProvider implements NumberProvider {
@Override
public int getInt(LootContext context) {
return context.randomSource().nextInt(this.min.getInt(context), this.max.getInt(context));
return context.randomSource().nextInt(this.min.getInt(context), this.max.getInt(context) + 1);
}
@Override