Configurable xp orb merge group count (#12503)
This commit is contained in:
@ -97,7 +97,7 @@
|
||||
Vec3 vec3 = new Vec3(
|
||||
this.followingPlayer.getX() - this.getX(),
|
||||
this.followingPlayer.getY() + this.followingPlayer.getEyeHeight() / 2.0 - this.getY(),
|
||||
@@ -161,16 +_,27 @@
|
||||
@@ -161,18 +_,29 @@
|
||||
}
|
||||
|
||||
public static void award(ServerLevel level, Vec3 pos, int amount) {
|
||||
@ -124,9 +124,17 @@
|
||||
private static boolean tryMergeToExisting(ServerLevel level, Vec3 pos, int amount) {
|
||||
+ // Paper - TODO some other event for this kind of merge
|
||||
AABB aabb = AABB.ofSize(pos, 1.0, 1.0, 1.0);
|
||||
int randomInt = level.getRandom().nextInt(40);
|
||||
- int randomInt = level.getRandom().nextInt(40);
|
||||
+ int randomInt = level.getRandom().nextInt(io.papermc.paper.configuration.GlobalConfiguration.get().misc.xpOrbGroupsPerArea.or(ORB_GROUPS_PER_AREA)); // Paper - Configure how many orb groups per area
|
||||
List<ExperienceOrb> entities = level.getEntities(EntityTypeTest.forClass(ExperienceOrb.class), aabb, orb -> canMerge(orb, randomInt, amount));
|
||||
@@ -193,9 +_,14 @@
|
||||
if (!entities.isEmpty()) {
|
||||
ExperienceOrb experienceOrb = entities.get(0);
|
||||
@@ -189,13 +_,18 @@
|
||||
}
|
||||
|
||||
private static boolean canMerge(ExperienceOrb orb, int amount, int other) {
|
||||
- return !orb.isRemoved() && (orb.getId() - amount) % 40 == 0 && orb.getValue() == other;
|
||||
+ return !orb.isRemoved() && (orb.getId() - amount) % io.papermc.paper.configuration.GlobalConfiguration.get().misc.xpOrbGroupsPerArea.or(ORB_GROUPS_PER_AREA) == 0 && orb.getValue() == other; // Paper - Configure how many orbs will merge together
|
||||
}
|
||||
|
||||
private void merge(ExperienceOrb orb) {
|
||||
|
||||
Reference in New Issue
Block a user