From 87e4e3cdbab3c0da7dedd1c8254e992619304f23 Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Tue, 14 Sep 2021 05:25:58 +0300 Subject: Added support for item type assumption based on properties file name Closes #18 --- src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/shcm/shsupercm') 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) { -- cgit