mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-26 18:39:11 +00:00
fix size
This commit is contained in:
@@ -55,7 +55,8 @@ public class DebugCommand {
|
||||
getSeasonCommand(),
|
||||
getGroupCommand(),
|
||||
getCategoryCommand(),
|
||||
getNBTCommand()
|
||||
getNBTCommand(),
|
||||
getLocationCommand()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,6 +67,13 @@ public class DebugCommand {
|
||||
});
|
||||
}
|
||||
|
||||
public CommandAPICommand getLocationCommand() {
|
||||
return new CommandAPICommand("location")
|
||||
.executesPlayer((player, arg) -> {
|
||||
AdventureManagerImpl.getInstance().sendMessage(player, player.getLocation().toString());
|
||||
});
|
||||
}
|
||||
|
||||
public CommandAPICommand getNBTCommand() {
|
||||
return new CommandAPICommand("nbt")
|
||||
.executesPlayer((player, arg) -> {
|
||||
@@ -168,7 +176,7 @@ public class DebugCommand {
|
||||
public record LootWithWeight(String key, double weight) {
|
||||
}
|
||||
|
||||
public static void quickSort(LootWithWeight[] loot, int low, int high) {
|
||||
private static void quickSort(LootWithWeight[] loot, int low, int high) {
|
||||
if (low < high) {
|
||||
int pi = partition(loot, low, high);
|
||||
quickSort(loot, low, pi - 1);
|
||||
@@ -176,7 +184,7 @@ public class DebugCommand {
|
||||
}
|
||||
}
|
||||
|
||||
public static int partition(LootWithWeight[] loot, int low, int high) {
|
||||
private static int partition(LootWithWeight[] loot, int low, int high) {
|
||||
double pivot = loot[high].weight();
|
||||
int i = low - 1;
|
||||
for (int j = low; j <= high - 1; j++) {
|
||||
@@ -189,7 +197,7 @@ public class DebugCommand {
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
public static void swap(LootWithWeight[] loot, int i, int j) {
|
||||
private static void swap(LootWithWeight[] loot, int i, int j) {
|
||||
LootWithWeight temp = loot[i];
|
||||
loot[i] = loot[j];
|
||||
loot[j] = temp;
|
||||
|
||||
@@ -726,7 +726,7 @@ public class ItemManagerImpl implements ItemManager, Listener {
|
||||
if (size == null) return this;
|
||||
editors.put("size", (player, nbtItem, placeholders) -> {
|
||||
NBTCompound cfCompound = nbtItem.getOrCreateCompound("CustomFishing");
|
||||
float random = size.left() + size.left() <= size.right() ? 0 : ThreadLocalRandom.current().nextFloat(size.right() - size.left());
|
||||
float random = size.left() + (size.left() >= size.right() ? 0 : ThreadLocalRandom.current().nextFloat(size.right() - size.left()));
|
||||
float bonus = Float.parseFloat(placeholders.getOrDefault("{size-multiplier}", "1.0"));
|
||||
double fixed = Double.parseDouble(placeholders.getOrDefault("{size-fixed}", "0.0"));
|
||||
random *= bonus;
|
||||
|
||||
Reference in New Issue
Block a user