Add experience points API
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
public final InventoryMenu inventoryMenu;
|
||||
public AbstractContainerMenu containerMenu;
|
||||
protected FoodData foodData = new FoodData();
|
||||
@@ -181,14 +191,26 @@
|
||||
@@ -181,13 +191,25 @@
|
||||
private Optional<GlobalPos> lastDeathLocation;
|
||||
@Nullable
|
||||
public FishingHook fishing;
|
||||
@@ -49,7 +49,7 @@
|
||||
private int currentImpulseContextResetGraceTime;
|
||||
+ public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||
+ public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public boolean fauxSleeping;
|
||||
+ public int oldLevel = -1;
|
||||
@@ -59,10 +59,9 @@
|
||||
+ return (CraftHumanEntity) super.getBukkitEntity();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public Player(Level world, BlockPos pos, float yaw, GameProfile gameProfile) {
|
||||
super(EntityType.PLAYER, world);
|
||||
this.lastItemInMainHand = ItemStack.EMPTY;
|
||||
@@ -244,6 +266,13 @@
|
||||
|
||||
if (this.isSleeping()) {
|
||||
@@ -95,10 +94,12 @@
|
||||
}
|
||||
|
||||
private boolean isEquipped(Item item) {
|
||||
@@ -513,6 +542,18 @@
|
||||
|
||||
}
|
||||
@@ -511,7 +540,19 @@
|
||||
super.handleEntityEvent(status);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - Inventory close reason; unused code, but to keep signatures aligned
|
||||
+ public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
|
||||
+ closeContainer();
|
||||
@@ -108,12 +109,11 @@
|
||||
+ // Paper start - special close for unloaded inventory
|
||||
+ public void closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
|
||||
+ this.containerMenu = this.inventoryMenu;
|
||||
+ }
|
||||
}
|
||||
+ // Paper end - special close for unloaded inventory
|
||||
+
|
||||
|
||||
public void closeContainer() {
|
||||
this.containerMenu = this.inventoryMenu;
|
||||
}
|
||||
@@ -523,8 +564,14 @@
|
||||
public void rideTick() {
|
||||
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
|
||||
@@ -541,9 +541,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1664,11 +1828,30 @@
|
||||
@@ -1662,13 +1826,32 @@
|
||||
}
|
||||
|
||||
public int getXpNeededForNextLevel() {
|
||||
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
||||
- return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
||||
+ return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); // Paper - diff on change; calculateTotalExperiencePoints
|
||||
}
|
||||
+ // Paper start - send while respecting visibility
|
||||
+ private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
|
||||
|
||||
Reference in New Issue
Block a user