Removed need for manual typecast

This commit is contained in:
lieght
2025-10-01 16:17:02 +02:00
parent dd74eaab43
commit 71dab89dc8
3 changed files with 9 additions and 2 deletions

View File

@@ -21,6 +21,13 @@ public class AssetManager {
}
}
@SuppressWarnings("unchecked")
public static <T extends BaseResource> T get(String name) {
Asset<T> asset = (Asset<T>) assets.get(name);
if (asset == null) return null;
return asset.getResource();
}
public static <T extends BaseResource> ArrayList<Asset<T>> getAllOfType(Class<T> type) {
ArrayList<Asset<T>> list = new ArrayList<>();
for (Asset<? extends BaseResource> asset : assets.values()) { // <-- use .values()