mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-04-01 01:05:27 +02:00
Fix naming convention for the logger
This commit is contained in:
parent
36c3136067
commit
eb25692aef
5 changed files with 14 additions and 14 deletions
|
@ -39,7 +39,7 @@ public class MineLittlePony implements ClientModInitializer {
|
||||||
|
|
||||||
private static MineLittlePony instance;
|
private static MineLittlePony instance;
|
||||||
|
|
||||||
public static final Logger logger = LogManager.getLogger("MineLittlePony");
|
public static final Logger LOGGER = LogManager.getLogger("MineLittlePony");
|
||||||
|
|
||||||
private PonyManagerImpl ponyManager;
|
private PonyManagerImpl ponyManager;
|
||||||
private VariatedTextureSupplier variatedTextures;
|
private VariatedTextureSupplier variatedTextures;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class PonyDataLoader {
|
||||||
try {
|
try {
|
||||||
return res.getMetadata().decode(SERIALIZER);
|
return res.getMetadata().decode(SERIALIZER);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
MineLittlePony.logger.warn("Unable to read {} metadata", identifier, e);
|
MineLittlePony.LOGGER.warn("Unable to read {} metadata", identifier, e);
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}).map(PonyDataLoader::loaded).orElseGet(() -> {
|
}).map(PonyDataLoader::loaded).orElseGet(() -> {
|
||||||
|
@ -54,7 +54,7 @@ public class PonyDataLoader {
|
||||||
NativeUtil.parseImage(identifier, image -> {
|
NativeUtil.parseImage(identifier, image -> {
|
||||||
callback.accept(new PonyData(image, noSkin));
|
callback.accept(new PonyData(image, noSkin));
|
||||||
}, e -> {
|
}, e -> {
|
||||||
MineLittlePony.logger.fatal("Unable to read {} metadata", identifier, e);
|
MineLittlePony.LOGGER.fatal("Unable to read {} metadata", identifier, e);
|
||||||
callback.accept(PonyData.NULL);
|
callback.accept(PonyData.NULL);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,16 +34,16 @@ public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceRe
|
||||||
.build(CacheLoader.from(key -> new Pony(key.texture(), PonyDataLoader.parse(key.texture(), key.defaulted()))));
|
.build(CacheLoader.from(key -> new Pony(key.texture(), PonyDataLoader.parse(key.texture(), key.defaulted()))));
|
||||||
private final WeakHashMap<UUID, Pony> playerPonies = new WeakHashMap<>();
|
private final WeakHashMap<UUID, Pony> playerPonies = new WeakHashMap<>();
|
||||||
|
|
||||||
record Key(Identifier texture, @Nullable UUID uuid, boolean defaulted) {}
|
record Key(Identifier texture, boolean defaulted) {}
|
||||||
|
|
||||||
public PonyManagerImpl(PonyConfig config) {
|
public PonyManagerImpl(PonyConfig config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
Instance.instance = this;
|
Instance.instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Pony loadPony(Identifier resource, @Nullable UUID uuid, boolean defaulted) {
|
private Pony loadPony(Identifier resource, boolean defaulted) {
|
||||||
try {
|
try {
|
||||||
return poniesCache.get(new Key(resource, uuid, defaulted));
|
return poniesCache.get(new Key(resource, defaulted));
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
return new Pony(resource, PonyDataLoader.NULL);
|
return new Pony(resource, PonyDataLoader.NULL);
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,10 @@ public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceRe
|
||||||
@Override
|
@Override
|
||||||
public Pony getPony(@Nullable Identifier resource, @Nullable UUID uuid) {
|
public Pony getPony(@Nullable Identifier resource, @Nullable UUID uuid) {
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
return uuid == null ? loadPony(DefaultSkinHelper.getTexture(), uuid, true) : getBackgroundPony(uuid);
|
return uuid == null ? loadPony(DefaultSkinHelper.getTexture(), true) : getBackgroundPony(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pony pony = loadPony(resource, uuid, false);
|
Pony pony = loadPony(resource, false);
|
||||||
|
|
||||||
if (uuid != null && PonyConfig.getInstance().ponyLevel.get() == PonyLevel.PONIES && pony.metadata().race().isHuman()) {
|
if (uuid != null && PonyConfig.getInstance().ponyLevel.get() == PonyLevel.PONIES && pony.metadata().race().isHuman()) {
|
||||||
return getBackgroundPony(uuid);
|
return getBackgroundPony(uuid);
|
||||||
|
@ -103,9 +103,9 @@ public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceRe
|
||||||
@Override
|
@Override
|
||||||
public Pony getBackgroundPony(@Nullable UUID uuid) {
|
public Pony getBackgroundPony(@Nullable UUID uuid) {
|
||||||
if (config.ponyLevel.get() == PonyLevel.PONIES) {
|
if (config.ponyLevel.get() == PonyLevel.PONIES) {
|
||||||
return loadPony(MineLittlePony.getInstance().getVariatedTextures().get(VariatedTextureSupplier.BACKGROUND_PONIES_POOL, uuid).orElse(DefaultSkinHelper.getSkinTextures(uuid).texture()), uuid, true);
|
return loadPony(MineLittlePony.getInstance().getVariatedTextures().get(VariatedTextureSupplier.BACKGROUND_PONIES_POOL, uuid).orElse(DefaultSkinHelper.getSkinTextures(uuid).texture()), true);
|
||||||
}
|
}
|
||||||
return loadPony(DefaultSkinHelper.getSkinTextures(uuid).texture(), uuid, true);
|
return loadPony(DefaultSkinHelper.getSkinTextures(uuid).texture(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -128,7 +128,7 @@ public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceRe
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
MineLittlePony.logger.info("Turned {} cached ponies into cupcakes.", poniesCache.size());
|
MineLittlePony.LOGGER.info("Turned {} cached ponies into cupcakes.", poniesCache.size());
|
||||||
poniesCache.invalidateAll();
|
poniesCache.invalidateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class VariatedTextureSupplier implements SimpleSynchronousResourceReloadL
|
||||||
public void reloadAll(ResourceManager resourceManager) {
|
public void reloadAll(ResourceManager resourceManager) {
|
||||||
textures.clear();
|
textures.clear();
|
||||||
textures.addAll(resourceManager.findResources(id.getPath(), path -> path.getPath().endsWith(".png")).keySet());
|
textures.addAll(resourceManager.findResources(id.getPath(), path -> path.getPath().endsWith(".png")).keySet());
|
||||||
MineLittlePony.logger.info("Detected {} ponies installed at {}.", textures.size(), id);
|
MineLittlePony.LOGGER.info("Detected {} ponies installed at {}.", textures.size(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isUser(UUID uuid) {
|
static boolean isUser(UUID uuid) {
|
||||||
|
|
|
@ -26,13 +26,13 @@ class GuiSkinsMineLP extends GuiSkins {
|
||||||
public GuiSkinsMineLP(Screen parent, SkinServerList servers) {
|
public GuiSkinsMineLP(Screen parent, SkinServerList servers) {
|
||||||
super(parent, servers);
|
super(parent, servers);
|
||||||
chooser.addSkinChangedEventListener(type -> {
|
chooser.addSkinChangedEventListener(type -> {
|
||||||
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
MineLittlePony.LOGGER.debug("Invalidating old local skin, checking updated local skin");
|
||||||
if (type == SkinType.SKIN) {
|
if (type == SkinType.SKIN) {
|
||||||
MineLittlePony.getInstance().getManager().removePony(previewer.getLocal().getSkins().get(SkinType.SKIN).getId());
|
MineLittlePony.getInstance().getManager().removePony(previewer.getLocal().getSkins().get(SkinType.SKIN).getId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
uploader.addSkinLoadedEventListener((type, location, profileTexture) -> {
|
uploader.addSkinLoadedEventListener((type, location, profileTexture) -> {
|
||||||
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
MineLittlePony.LOGGER.debug("Invalidating old remote skin, checking updated remote skin");
|
||||||
if (type == SkinType.SKIN) {
|
if (type == SkinType.SKIN) {
|
||||||
MineLittlePony.getInstance().getManager().removePony(location);
|
MineLittlePony.getInstance().getManager().removePony(location);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue