Upstream Paper

This commit is contained in:
Sotr
2018-07-28 22:38:20 +08:00
parent 2def9e628a
commit af7444df09
3 changed files with 19 additions and 11 deletions

View File

@@ -1813,21 +1813,26 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
public Chunk getChunkAtLocation() {
return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4);
}
public final MinecraftKey entityKey = EntityTypes.getKey(this);
public final String entityKeyString = entityKey != null ? entityKey.toString() : null;
private String entityKeyString = null;
private MinecraftKey entityKey = getMinecraftKey();
@Override
public MinecraftKey getMinecraftKey() {
if (entityKey == null) {
entityKey = EntityTypes.getKey(this);
entityKeyString = entityKey != null ? entityKey.toString() : null;
}
return entityKey;
}
@Override
public String getMinecraftKeyString() {
getMinecraftKey(); // Try to load if it doesn't exists. see: https://github.com/PaperMC/Paper/issues/1280
return entityKeyString;
}
@Nullable
public final String getSaveID() {
return entityKeyString;
return getMinecraftKeyString();
// Paper end
}