mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-08-17 08:45:56 +00:00
use proper shuffling algorithm for the loot
This commit is contained in:
parent
172e234514
commit
944cc19ebc
@ -78,7 +78,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -457,14 +456,11 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = nitems.length; i > 1; i--) {
|
||||||
try {
|
int j = rng.nextInt(i);
|
||||||
Arrays.parallelSort(nitems, (a, b) -> rng.nextInt());
|
ItemStack tmp = nitems[i - 1];
|
||||||
break;
|
nitems[i - 1] = nitems[j];
|
||||||
} catch (Throwable e) {
|
nitems[j] = tmp;
|
||||||
Iris.reportError(e);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inventory.setContents(nitems);
|
inventory.setContents(nitems);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user