-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6889c3b
commit 4dfa320
Showing
6 changed files
with
117 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/xiamomc/morph/backends/server/renderer/skins/SingleSkin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package xiamomc.morph.backends.server.renderer.skins; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import net.minecraft.Util; | ||
import xiamomc.morph.misc.MorphGameProfile; | ||
|
||
import java.util.UUID; | ||
|
||
public class SingleSkin | ||
{ | ||
public String name = "unknown"; | ||
|
||
public UUID uuid = Util.NIL_UUID; | ||
|
||
public String texture = ""; | ||
|
||
public String signature = ""; | ||
|
||
public int expiresAt = 0; | ||
|
||
/* | ||
public static SingleSkin fromProfile(GameProfile profile) | ||
{ | ||
var wrapped = new MorphGameProfile(profile); | ||
var instance = new SingleSkin(); | ||
instance.name = profile.getName(); | ||
instance.uuid = profile.getId(); | ||
} | ||
*/ | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/xiamomc/morph/backends/server/renderer/skins/SkinStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package xiamomc.morph.backends.server.renderer.skins; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import com.mojang.authlib.properties.Property; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import xiamomc.morph.misc.MorphGameProfile; | ||
import xiamomc.morph.storage.MorphJsonBasedStorage; | ||
|
||
public class SkinStore extends MorphJsonBasedStorage<SkinStoreRoot> | ||
{ | ||
@Override | ||
protected @NotNull String getFileName() | ||
{ | ||
return "stored_skins.json"; | ||
} | ||
|
||
@Override | ||
protected @NotNull SkinStoreRoot createDefault() | ||
{ | ||
return new SkinStoreRoot(); | ||
} | ||
|
||
@Override | ||
protected @NotNull String getDisplayName() | ||
{ | ||
return "Server renderer skin store"; | ||
} | ||
/* | ||
@Nullable | ||
public GameProfile getProfile(String skinName) | ||
{ | ||
var matchedSkin = storingObject.storedSkins.stream() | ||
.filter(skin -> skin.name.equalsIgnoreCase(skinName)) | ||
.findFirst().orElse(null); | ||
if (matchedSkin == null) return null; | ||
var profile = new GameProfile(matchedSkin.uuid, matchedSkin.name); | ||
profile.getProperties().put("textures", new Property()) | ||
} | ||
*/ | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/xiamomc/morph/backends/server/renderer/skins/SkinStoreRoot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package xiamomc.morph.backends.server.renderer.skins; | ||
|
||
import it.unimi.dsi.fastutil.objects.ObjectArrayList; | ||
|
||
import java.util.List; | ||
|
||
public class SkinStoreRoot | ||
{ | ||
public List<SingleSkin> storedSkins = new ObjectArrayList<>(); | ||
} |