Added debug
This commit is contained in:
parent
4045bc5839
commit
d6858c293d
@ -36,10 +36,10 @@ public class Plugin extends PluginBase {
|
||||
// Register Blocks
|
||||
Reflections blockReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_blocks");
|
||||
// Log super classes of each class in the package
|
||||
blockReflections.getSubTypesOf(Object.class).forEach(clazz -> getLogger().info(clazz + " extends " + clazz.getSuperclass()));
|
||||
blockReflections.getSubTypesOf(Object.class).forEach(clazz -> System.out.println(clazz + " extends " + clazz.getSuperclass()));
|
||||
|
||||
// Log block classes
|
||||
blockReflections.getSubTypesOf(Object.class).forEach(clazz -> getLogger().info(clazz + " is a block class"));
|
||||
blockReflections.getSubTypesOf(Object.class).forEach(clazz -> System.out.println(clazz + " is a block class"));
|
||||
|
||||
Set<Class<? extends CustomBlock>> blocks = blockReflections.getSubTypesOf(Object.class).stream()
|
||||
.filter(clazz -> clazz.getSuperclass() == CustomBlock.class)
|
||||
@ -47,7 +47,7 @@ public class Plugin extends PluginBase {
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (Class<? extends CustomBlock> clazz : blocks) {
|
||||
getLogger().info("§aLoading custom block " + clazz + "...");
|
||||
System.out.println("§aLoading custom block " + clazz + "...");
|
||||
try {
|
||||
Block.registerCustomBlock(Collections.singletonList(clazz)).assertOK();
|
||||
} catch (AssertionError e) {
|
||||
@ -58,7 +58,7 @@ public class Plugin extends PluginBase {
|
||||
// Register Items
|
||||
Reflections itemReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_items");
|
||||
// Log super classes of each class in the package
|
||||
itemReflections.getSubTypesOf(Object.class).forEach(clazz -> getLogger().info(clazz + " extends " + clazz.getSuperclass()));
|
||||
itemReflections.getSubTypesOf(Object.class).forEach(clazz -> System.out.println(clazz + " extends " + clazz.getSuperclass()));
|
||||
|
||||
Set<Class<? extends CustomItem>> items = itemReflections.getSubTypesOf(Object.class).stream()
|
||||
.filter(clazz -> clazz.getSuperclass() == CustomItem.class)
|
||||
@ -66,7 +66,7 @@ public class Plugin extends PluginBase {
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (Class<? extends CustomItem> clazz : items) {
|
||||
getLogger().info("§aLoading custom item " + clazz + "...");
|
||||
System.out.println("§aLoading custom item " + clazz + "...");
|
||||
try {
|
||||
Item.registerCustomItem(clazz).assertOK();
|
||||
} catch (AssertionError e) {
|
||||
@ -77,7 +77,7 @@ public class Plugin extends PluginBase {
|
||||
// Register Entities
|
||||
Reflections entityReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_entities");
|
||||
// Log super classes of each class in the package
|
||||
entityReflections.getSubTypesOf(Object.class).forEach(clazz -> getLogger().info(clazz + " extends " + clazz.getSuperclass()));
|
||||
entityReflections.getSubTypesOf(Object.class).forEach(clazz -> System.out.println(clazz + " extends " + clazz.getSuperclass()));
|
||||
|
||||
Set<Class<? extends Entity>> entities = itemReflections.getSubTypesOf(Object.class).stream()
|
||||
.filter(clazz -> clazz.getSuperclass() == Entity.class)
|
||||
@ -85,7 +85,7 @@ public class Plugin extends PluginBase {
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (Class<? extends Entity> clazz : entities) {
|
||||
getLogger().info("§aLoading custom entity " + clazz + "...");
|
||||
System.out.println("§aLoading custom entity " + clazz + "...");
|
||||
try {
|
||||
Entity.registerCustomEntity(new CustomClassEntityProvider(clazz)).assertOK();
|
||||
entities.add(clazz);
|
||||
@ -94,12 +94,12 @@ public class Plugin extends PluginBase {
|
||||
}
|
||||
}
|
||||
|
||||
getLogger().info("§aCustomResources has been enabled!");
|
||||
System.out.println("§aCustomResources has been enabled!");
|
||||
}
|
||||
|
||||
public static void tickComponents(Entity entity) {
|
||||
if (!(entity instanceof EntityIntelligent)) return;
|
||||
getInstance().getServer().getPluginManager().getPlugin("NukkitAddonReader").getLogger().info("Ticking components for entity: " + entity.getName());
|
||||
System.out.println("Ticking components for entity: " + entity.getName());
|
||||
if (getInstance().getServer().getPluginManager().getPlugin("NukkitAddonReader") instanceof com.cimeyclust.addonreader.Plugin pl) {
|
||||
pl.tickComponents((EntityIntelligent) entity);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user