fix: getExperienceOrbValue
- исправлен getExperienceOrbValue
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.nukkit.entity.Entity;
|
||||
import cn.nukkit.entity.EntityHuman;
|
||||
import cn.nukkit.entity.EntityRideable;
|
||||
import cn.nukkit.entity.item.EntityItem;
|
||||
import cn.nukkit.entity.item.EntityXPOrb;
|
||||
import cn.nukkit.entity.projectile.EntityProjectile;
|
||||
import cn.nukkit.event.entity.EntityDamageEvent;
|
||||
import cn.nukkit.item.Item;
|
||||
@@ -389,4 +390,11 @@ public class EntityMethod {
|
||||
if(entity != null)
|
||||
entity.teleport(Location.fromObject(entity.getPosition(), BlockSourceMethods.getLevelForDimension(dimension)));
|
||||
}
|
||||
|
||||
public static int getExperienceOrbValue(long unwrapEntity) {
|
||||
Entity entity = getEntityToLong(unwrapEntity);
|
||||
if(entity instanceof EntityXPOrb xp)
|
||||
return xp.getExp();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -47,8 +47,7 @@ public class StaticEntity {
|
||||
}
|
||||
|
||||
public static int getExperienceOrbValue(long entity) {
|
||||
CompoundTag tag = EntityMethod.getEntityCompoundTag(entity);
|
||||
return tag != null ? new NativeCompoundTag(tag).getInt("experience value") : 0;
|
||||
return EntityMethod.getExperienceOrbValue(entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user