Jump to content

hohserg

Members
  • Posts

    57
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

hohserg's Achievements

Stone Miner

Stone Miner (3/8)

3

Reputation

  1. Thx for answer! I mean not something like documentation, more like showcase, but for modders instead of end-users. Anyway, each topic at "User Submitted Tutorials" must represent useful knowledge, I understand this. Really?
  2. Hello! I'm developing my framework for modding and I wanna to narrate about framework at ForgeForum. Seems subforum "User Submitted Tutorials" is a good place and form for it But I have some doubts. Will there be a tutorial about own framework rated as advertising or something like this? P.S. This question is intended for @diesieben07, but his pm is closed, so it here.
  3. I found a strange bug that can be reproduced by steps: Create empty gradle project(without any plugins) (by intellij idea) Create submodule `app` which contain regular forge mdk Create submodule `common` which contain annotation `Mark` and class `ClassFromSubmodule` Create submodule `annotation-processor` which contain anootation processor which generate simple companion class for each class annotated with `@Mark` Add some code: //Test.java, `app` submodule //annotation processor will generate TestCompanion for it(and he doing it) @Mark public class Test { } //Main.java, `app` submodule @Mod("strange_bug") public class Main { public Main() { try { System.out.println("Main successful: " + Class.forName("hohserg.strange.bug.TestCompanion")); } catch (ClassNotFoundException e) { System.out.println("Main failed: "); e.printStackTrace(); } ClassFromSubmodule.test(); } } //ClassFromSubmodule.java, `common` submodule public class ClassFromSubmodule { public static void test() { try { System.out.println("ClassFromSubmodule successful: " + Class.forName("hohserg.strange.bug.TestCompanion")); } catch (Throwable e) { System.out.println("ClassFromSubmodule failed: "); e.printStackTrace(); } } } Run `gradle :app:genIntellijRuns` Try run client Got follow log (time mark removed): [modloading-worker-0/INFO] [STDOUT/]: [hohserg.strange.bug.Main:<init>:9]: Main successful: class hohserg.strange.bug.TestCompanion [modloading-worker-0/INFO] [STDOUT/]: [hohserg.strange.bug.ClassFromSubmodule:test:8]: ClassFromSubmodule failed: [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: java.lang.ClassNotFoundException: hohserg.strange.bug.TestCompanion [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.net.URLClassLoader.findClass(URLClassLoader.java:382) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.lang.ClassLoader.loadClass(ClassLoader.java:418) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.lang.ClassLoader.loadClass(ClassLoader.java:351) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.lang.Class.forName0(Native Method) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.lang.Class.forName(Class.java:264) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at hohserg.strange.bug.ClassFromSubmodule.test(ClassFromSubmodule.java:6) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at hohserg.strange.bug.Main.<init>(Main.java:14) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.lang.Class.newInstance(Class.java:442) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1640) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [modloading-worker-0/INFO] [STDERR/]: [hohserg.strange.bug.ClassFromSubmodule:test:9]: at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) So, class which generated by annotation processor is accessible from Main class(main class of mod) and isn't accessible from class from submodule. Bug is preserved in built jar of mod if it's added as dependency to another mdk project. Bug isn't preserved in built jar of mod if it's running at regular game client. I checked, it's bug does not appears if `app` submodule is simply java application (without mdk) I checked some other cases and resultative limits of bug: Attempt to access to class which generated by annotation processor by `Class.forName` from class from other submodule in dev workspace perform `ClassNotFoundException` Running game with `.\StrangeBugRoot\gradlew.bat --project-dir ./StrangeBugRoot/ :app:runClient` does not produce bug. Full source code: https://github.com/hohserg1/StrangeBug
  4. I found a pretty thing: `IModLocator#findPath` It's look as good solve to get actual location of "service" files for each mod
  5. Well. How to determine which class does the mod relate to? Look excessive Maybe it's a bad idea to call this thing as 'service'. Service is a most similar thing. Generally thing which I need is a file with list of names of classes which been found(and generated) by my annotation processor and readable by my mod. And multiple mods in one modpack can contain such file Sorry, it's my wrong understanding of ServiceLoader
  6. If I use ServiceLoader, how it will work with multiple jars with identically named service files? As I know, ServiceLoader resolves existence of multiple same service files by taking first. It's also can resolve by ClassLoader, but I dont know, is Forge use separeted class loaders for each mod and is it be true it future. Also, ServiceLoader gives instances of classes which specified in service, but I'm need to instances of Class<?> of these classes. So, standard utility is not look as appropriate
  7. I doing my annotation processor which generate service file for current mod. And I doing my mod which looking for such services in all mods in modpack. Forge can provide location of mod, whether it is an jar or in-dev-folder. The problem is getting actual location of service file. For jar is trivially and work fine. For in-dev-folder it's hard: File provided by Forge is not only one folder with mod files (look screenshot) It's really problematic and now I'm stumped. Any ideas? Also I can consider other ways instead of services. Related code: https://github.com/ElegantNetworking/ElegantNetworking_1.16/blob/master/src/main/java/hohserg/elegant/networking/impl/Main.java#L18-L20 https://github.com/ElegantNetworking/ElegantNetworking_1.16/blob/master/build.gradle#L111 Debug screenshot: Some note: for example I made mod which looking for services and mod within services in one bottle, and you can see it on screenshot, but it's irrelevant to the problem.
  8. I want to read capability of offline player
  9. How to get `File` instance for directory which contain saved world? At 1.12.2 I can use `DimensionManager#getCurrentSaveRootDirectory`. What analogue at 1.16.5?
  10. What is analogue of -Dlegacy.debugClassLoading=true -Dlegacy.debugClassLoadingSave=true arguments for 1.16.4?
  11. Seems like I didn't understand sense of log level and trace markers. Can you explain it?
  12. Oops, not solved I use `-Dforge.logging.console.level=debug -Dforge.logging.markers=SCAN,REGISTRIES,REGISTRYDUMP,CLASSLOADING` But messages of `LOGGER.trace(CLASSLOADING, ...)` is not visible in debug.log file
  13. Ok, it solved `-Dforge.logging.console.level=debug`
  14. Is it possible from command line arguments also?
  15. Minecraft and Forge contains some code like LOGGER.trace(CLASSLOADING, ...); I want to see such messages in log (better to see all log messages). I didn't find `log4j2.xml`or something similar at game jar. How to change default log level?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.