Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

hohserg

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by hohserg

  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?
  16. I set up a publication to maven, but using `fg.deobf` warped dependency version in pom-file. How to fix? My build.gradle: https://github.com/ElegantNetworking/ElegantNetworking_1.15/blob/master/build.gradle Problem in pom: <dependency> <groupId>codechicken</groupId> <artifactId>CodeChickenLib</artifactId> <version>1.15.2-3.3.4.402_mapped_snapshot_20200514-1.15.1</version> <classifier>universal</classifier> <scope>compile</scope> </dependency> `1.15.2-3.3.4.402_mapped_snapshot_20200514-1.15.1` is not correct version `1.15.2-3.3.4.402` is correct version
  17. I set up a publication to maven, but using `fg.deobf` warped dependency version in pom-file. How to fix? My build.gradle: https://github.com/ElegantNetworking/ElegantNetworking_1.14/blob/master/build.gradle Problem in pom: <dependencies> <dependency> <groupId>codechicken</groupId> <artifactId>CodeChickenLib</artifactId> <version>1.14.4-3.2.8.374_mapped_snapshot_20190719-1.14.3</version> <classifier>universal</classifier> <scope>compile</scope> </dependency> </dependencies> `1.14.4-3.2.8.374_mapped_snapshot_20190719-1.14.3` is not correct. `1.14.4-3.2.8.374` is correct
  18. I found similar question: But it unsolved
  19. I added follow code to my build script for replace ${version} placeholder in my toml by gradle project version processResources { // This will ensure that this task is redone when the versions change. inputs.property 'version', project.version // Replace stuff in mods.toml, nothing else from(sourceSets.main.resources.srcDirs) { include 'META-INF/mods.toml' // Replace version expand 'version':project.version } // Copy everything else except the mods.toml from(sourceSets.main.resources.srcDirs) { exclude 'META-INF/mods.toml' } } On build it crashes with * What went wrong: Execution failed for task ':ElegantNetworking_1.16:processResources'. > Could not copy file 'C:\Users\hohserg\Documents\GitHub\ElegantNetworking1\ElegantNetworking_1.16\src\main\resources\META-INF\mods.toml' to 'C:\Users\hohserg\Documents\GitHub\ElegantNetworking1\ElegantNetworking_1.16\build\resources\main\META-INF\mods.toml'. How to insert version to toml by gradle?
  20. Maybe, your check perform on client? And tile on client is not synchronized with server. Try to open chest for sync.
  21. Something like that: public static CompoundNBT getNbtOfTile(TileEntity tile) { CompoundNBT nbt = new CompoundNBT(); tile.write(nbt); return nbt; }
  22. Such item exists in ActuallyAditions: https://github.com/Ellpeck/ActuallyAdditions/blob/1.12.2/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java#L32
  23. I'm sorry for necroposting... But how to add some obfuscated mod to 1.14+ workspace? CodeChickenCore ceased releasing in 1.10 because Forge(or ForgeGradle or anything else) became able to work with obfucated mods out of the box. But it ceased work in 1.14. Any ideas?
  24. I try answer from stackoverflow: https://stackoverflow.com/questions/3923129/get-a-list-of-resources-from-classpath-directory And it work correctly when I run game from my IDE(Intellij Idea). But when I build mod, put jar in /mods/ and run Minecraft from launcher, it method give empty filelist. Hovewer, content of files in folder are load fine. What is true way to get list of files in directory in resources? Thx in advance!
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.