diff options
author | SHsuperCM <shsupercm@gmail.com> | 2021-09-14 05:25:58 +0300 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2021-09-14 05:25:58 +0300 |
commit | 87e4e3cdbab3c0da7dedd1c8254e992619304f23 (patch) | |
tree | b3c2e361ecd9d7123acb649b3a443849272c28a6 | |
parent | 4fb9c09fb4f5178a85b37915524b2836fe059a6a (diff) | |
download | CITResewn-87e4e3cdbab3c0da7dedd1c8254e992619304f23.tar.gz CITResewn-87e4e3cdbab3c0da7dedd1c8254e992619304f23.tar.bz2 CITResewn-87e4e3cdbab3c0da7dedd1c8254e992619304f23.zip |
Added support for item type assumption based on properties file name
Closes #18
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java index e618a6f..98e94f6 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java @@ -54,6 +54,15 @@ public abstract class CIT { throw new Exception("Unknown item " + itemId); this.items.add(Registry.ITEM.get(itemIdentifier)); } + if (this.items.isEmpty()) + try { + String id = propertiesIdentifier.getPath().substring(0, propertiesIdentifier.getPath().length() - 11); + String[] split = id.split("/"); + id = split[split.length - 1]; + Identifier itemId = new Identifier(propertiesIdentifier.getNamespace(), id); + if (Registry.ITEM.containsId(itemId)) + this.items.add(Registry.ITEM.get(itemId)); + } catch (Exception ignored) { } String damage = properties.getProperty("damage"); if (damageAny = damage == null) { |