Added better debug method

This commit is contained in:
Verox 2023-10-08 12:44:57 +02:00
parent 4044e6ca53
commit 59c7187bab

View File

@ -37,11 +37,11 @@ public class Plugin extends PluginBase {
instance = this; instance = this;
entities = new ArrayList<>(); entities = new ArrayList<>();
entityNames = new ArrayList<>(); entityNames = new ArrayList<>();
// %entitynames% // %entitynames%
blockNames = new ArrayList<>(); blockNames = new ArrayList<>();
// %blocknames% // %blocknames%
itemNames = new ArrayList<>(); itemNames = new ArrayList<>();
// %itemnames% // %itemnames%
} }
@Override @Override
@ -67,11 +67,12 @@ public class Plugin extends PluginBase {
for (String blockName : blockNames) { for (String blockName : blockNames) {
System.out.println("§aLoading custom block " + blockName + "..."); getLogger().info("§aLoading custom block " + blockName + "...");
try { try {
Class<? extends CustomBlock> clazz = Class.forName("com.cimeyclust.addonreader.resources.custom_blocks." + blockName).asSubclass(CustomBlock.class); Class<? extends CustomBlock> clazz = Class.forName("com.cimeyclust.addonreader.resources.custom_blocks." + blockName).asSubclass(CustomBlock.class);
Block.registerCustomBlock(Collections.singletonList(clazz)).assertOK(); Block.registerCustomBlock(Collections.singletonList(clazz)).assertOK();
} catch (AssertionError | ClassNotFoundException e) { } catch (AssertionError | ClassNotFoundException e) {
getLogger().error("§cFailed to load custom block " + blockName + "!");
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -87,11 +88,12 @@ public class Plugin extends PluginBase {
.collect(Collectors.toSet());*/ .collect(Collectors.toSet());*/
for (String itemName : itemNames) { for (String itemName : itemNames) {
System.out.println("§aLoading custom item " + itemName + "..."); getLogger().info("§aLoading custom item " + itemName + "...");
try { try {
Class<? extends CustomItem> clazz = Class.forName("com.cimeyclust.addonreader.resources.custom_items." + itemName).asSubclass(CustomItem.class); Class<? extends CustomItem> clazz = Class.forName("com.cimeyclust.addonreader.resources.custom_items." + itemName).asSubclass(CustomItem.class);
Item.registerCustomItem(clazz).assertOK(); Item.registerCustomItem(clazz).assertOK();
} catch (AssertionError | ClassNotFoundException e) { } catch (AssertionError | ClassNotFoundException e) {
getLogger().error("§cFailed to load custom item " + itemName + "!");
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -107,17 +109,18 @@ public class Plugin extends PluginBase {
.collect(Collectors.toSet());*/ .collect(Collectors.toSet());*/
for (String entityName : entityNames) { for (String entityName : entityNames) {
System.out.println("§aLoading custom entity " + entityName + "..."); getLogger().info("§aLoading custom entity " + entityName + "...");
try { try {
Class<? extends Entity> clazz = Class.forName("com.cimeyclust.addonreader.resources.custom_entities." + entityName).asSubclass(Entity.class); Class<? extends Entity> clazz = Class.forName("com.cimeyclust.addonreader.resources.custom_entities." + entityName).asSubclass(Entity.class);
Entity.registerCustomEntity(new CustomClassEntityProvider(clazz)).assertOK(); Entity.registerCustomEntity(new CustomClassEntityProvider(clazz)).assertOK();
this.entities.add(clazz); this.entities.add(clazz);
} catch (AssertionError | ClassNotFoundException e) { } catch (AssertionError | ClassNotFoundException e) {
getLogger().error("§cFailed to load custom entity " + entityName + "!");
e.printStackTrace(); e.printStackTrace();
} }
} }
System.out.println("CustomResources has been enabled!"); getLogger().info("CustomResources has been enabled!");
} }
public static void tickComponents(Entity entity) { public static void tickComponents(Entity entity) {