2021-06-29 18:34:20 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
|
|
Date: Tue, 29 Jun 2021 17:17:34 +0100
|
|
|
|
Subject: [PATCH] Don't complete skull lookups on main thread (MC-227435)
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
2021-07-01 01:10:28 +02:00
|
|
|
index 172413fc0f303d5e15bc2bc55c09ce4faf5298a0..96863338e1642105f71e681ec2b32c882b3ea342 100644
|
2021-06-29 18:34:20 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
2021-07-01 01:10:28 +02:00
|
|
|
@@ -145,15 +145,28 @@ public class SkullBlockEntity extends BlockEntity {
|
2021-06-29 18:34:20 +02:00
|
|
|
|
|
|
|
public static void updateGameprofile(@Nullable GameProfile owner, Consumer<GameProfile> callback) {
|
|
|
|
if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && SkullBlockEntity.profileCache != null && SkullBlockEntity.sessionService != null) {
|
|
|
|
- SkullBlockEntity.profileCache.getAsync(owner.getName(), (gameprofile1) -> {
|
|
|
|
+ // Paper start
|
|
|
|
+ SkullBlockEntity.profileCache.getAsync(owner.getName(), (gameprofile) -> {
|
2021-07-01 01:10:28 +02:00
|
|
|
+ if (gameprofile == null) {
|
|
|
|
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> callback.accept(owner));
|
|
|
|
+ return;
|
|
|
|
+ }
|
2021-06-29 18:34:20 +02:00
|
|
|
+ Runnable runnable = () -> {
|
|
|
|
+ GameProfile gameprofile1 = gameprofile;
|
|
|
|
Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null);
|
|
|
|
|
|
|
|
if (property == null) {
|
|
|
|
gameprofile1 = SkullBlockEntity.sessionService.fillProfileProperties(gameprofile1, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
- SkullBlockEntity.profileCache.add(gameprofile1);
|
|
|
|
- callback.accept(gameprofile1);
|
|
|
|
+ GameProfile finalGameprofile = gameprofile1;
|
|
|
|
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
|
|
|
|
+ SkullBlockEntity.profileCache.add(finalGameprofile);
|
|
|
|
+ callback.accept(finalGameprofile);
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ net.minecraft.Util.backgroundExecutor().execute(runnable);
|
|
|
|
+ // Paper end
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
callback.accept(owner);
|