9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2026-01-04 15:41:35 +00:00

Fix size & score effect

This commit is contained in:
XiaoMoMi
2024-08-18 00:08:16 +08:00
parent 17dd3705d0
commit 4b561602a8
4 changed files with 19 additions and 1 deletions

View File

@@ -484,6 +484,19 @@ public class BukkitConfigManager extends ConfigManager {
double minSize = min.evaluate(context);
double maxSize = max.evaluate(context);
float size = (float) RandomUtils.generateRandomDouble(minSize, maxSize);
Double sm = context.arg(ContextKeys.SIZE_MULTIPLIER);
if (sm == null) sm = 1.0;
Double sa = context.arg(ContextKeys.SIZE_ADDER);
if (sa == null) sa = 0.0;
size = (float) (sm * size + sa);
if (restrictedSizeRange()) {
if (size > maxSize) {
size = (float) maxSize;
}
if (size < minSize) {
size = (float) minSize;
}
}
item.setTag(size, "CustomFishing", "size");
context.arg(ContextKeys.SIZE, size);
context.arg(ContextKeys.MIN_SIZE, minSize);