GithubHelp home page GithubHelp logo

architectury-templates's Introduction

Architectury API

Talk to us on Discord!

An intermediary api aimed to ease developing multiplatform mods.

What is Architectury API

Architectury API is an api to abstract calls to fabric api and forge api as both loader has different implementations of what can be perceived as the same thing.

Architectury API updates regularly, with new hooks and features. Currently contains over 90 events hooks, networking abstraction, loader calls abstraction, game registry abstraction and an easy to use @ExpectPlatform annotation (Only works on static methods).

Do I really need this API?

Architectury API is only one part of the architectury ecosystem, Architectury Plugin is the gradle plugin enabling all this multiplatform actions.

Architectury API is optional for projects built on architectury, you may create your architectury project with just Architectury Plugin.

Advantages of Architectury

  • Open sourced
  • Less boilerplate for your multiplatform mod

Getting started with making multiplatform mods

Architectury Loom: https://github.com/architectury/architectury-loom (a fork of Fabric Loom adding multiplatform development capabilities) Gradle Plugin: https://github.com/architectury/architectury-plugin (includes Architectury Injectables, for the @ExpectPlatform annotation) Example Mod: https://github.com/architectury/architectury-example-mod (a discontinued example mod using Architectury, if possible, use the templates instead) Mod Templates: https://github.com/architectury/architectury-templates (a set of templates to get started using the Architectury toolchain)

Example: Usage of @ExpectPlatform

Exmaple of the @ExpectPlatform annotation, part of Architectury Injectables

Credits

In certain older versions, this library used to bundle typetools; you can find its license here

architectury-templates's People

Contributors

florensie avatar juuxel avatar maxneedssnacks avatar michaelhillcox avatar nxllpointer avatar shedaniel avatar thexxturboxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

architectury-templates's Issues

forge-fabric-quilt-mixin templates are broken for Quilt

The template "*-forge-fabric-quilt-mixin" is broken when running it for Quilt without doing any modifications.

It crashes because it tries to load the common mixins from the quilt folder instead of using the common folder:

java.io.UncheckedIOException: java.nio.file.NoSuchFileException: C:\1.20.1-forge-fabric-quilt-mixin\quilt\build\resources\main\examplemod-common.mixins.json
	at org.quiltmc.loader.impl.transformer.TransformCache.extractRefmap(TransformCache.java:214) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.transformer.TransformCache.<init>(TransformCache.java:85) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.transformer.TransformCacheGenerator.generate(TransformCacheGenerator.java:45) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.transformer.TransformCacheManager.writeTransformCache(TransformCacheManager.java:287) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.transformer.TransformCacheManager.createTransformCache(TransformCacheManager.java:260) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.transformer.TransformCacheManager.populateTransformBundle(TransformCacheManager.java:100) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.QuiltLoaderImpl.setup(QuiltLoaderImpl.java:375) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.QuiltLoaderImpl.load(QuiltLoaderImpl.java:304) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.launch.knot.Knot.init(Knot.java:149) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:78) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:28) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) ~[dev-launch-injector-0.2.1+build.8.jar:?]
	at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:219) ~[architectury-transformer-5.2.83-runtime.jar:5.2.83]
Caused by: java.nio.file.NoSuchFileException: C:\1.20.1-forge-fabric-quilt-mixin\quilt\build\resources\main\examplemod-common.mixins.json
	at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85) ~[?:?]
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) ~[?:?]
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) ~[?:?]
	at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:236) ~[?:?]
	at java.nio.file.Files.newByteChannel(Files.java:380) ~[?:?]
	at java.nio.file.Files.newByteChannel(Files.java:432) ~[?:?]
	at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422) ~[?:?]
	at java.nio.file.Files.newInputStream(Files.java:160) ~[?:?]
	at java.nio.file.Files.newBufferedReader(Files.java:2922) ~[?:?]
	at java.nio.file.Files.newBufferedReader(Files.java:2955) ~[?:?]
	at org.quiltmc.loader.impl.lib.parsers.json.JsonReader.<init>(JsonReader.java:353) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.lib.parsers.json.JsonReader.json(JsonReader.java:319) ~[quilt-loader-0.21.2-beta.2.jar:?]
	at org.quiltmc.loader.impl.transformer.TransformCache.extractRefmap(TransformCache.java:203) ~[quilt-loader-0.21.2-beta.2.jar:?]

Steps:

  • Download a template containnig "forge-fabric-quilt-mixin" (1.20.1-forge-fabric-quilt-mixin,zip for example).
  • Open the template and run Quilt client.
  • Notice the crash.

:common resources are not included when running via IDE

The sourceJar task adds sources & resources from the :common project, however nothing does this when running via IDE run tasks or (I assume) the runClient gradle task.

This means resources (such as icons and textures) are missing when debugging.

Oddly, i18n still seems to work, despite lang files also being missing from the build, which is odd...

Workaround

Original workaround

I'm currently "fixing" this by manually tweaking the sourceSet:

sourceSets {
    main {
        resources {
            resources.srcDir tasks.getByPath(":common:processResources").outputs

        }
    }
}

But that means I end up having to set DuplicatesStrategy.EXCLUDE in sourcesJar's commonSources map, which feels a bit hacky.

EDIT: the workaround above breaks production's mixin refMaps, I ended up moving all my assets into a separate source set, and include that instead:

// common bulid.gradle
sourceSets {
    assets {
        java.srcDirs = []
    }
}


// forge/fabric build.gradle
sourceSets {
    main {
        resources {
            resources.srcDir tasks.getByPath(":common:processAssetsResources").outputs
        }
    }
}

This works in production and also doesn't need the sourcesJar workaround.

Intellij runs not compileing befor run

After i imported project in to idea with runing following commands

.\gradlew.bat configureClientLaunch
.\gradlew.bat idea
.\gradlew.bat openIdea

i tryed to launch game with idea runs but it's not compiling code until i run

.\gradlew.bat runClient

manually

this is my gradle.properties

# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G

# tell architectury loom that this project is a forge project.
# this will enable us to use the "forge" dependency.
# using archloom without this is possible and will give you a
# "standard" loom installation with some extra features.
loom.platform=forge

# Base properties
    # minecraft version
    minecraft_version=1.19.3
    # forge version, latest version can be found on https://files.minecraftforge.net/
    forge_version=1.19.3-44.1.0
    # yarn, latest version can be found on https://fabricmc.net/develop/
    yarn_mappings=1.19.3+build.5

# Mod Properties
    mod_version=1.0.0
    maven_group=com.example.examplemod
    archives_base_name=archloom-example-mod
    mod_id=archloom-example-mod
    mod_author=TheExampleDev

Remapping problem

The way the template currently handles shadowing ignores the fact that subprojects may use different mappings.
Instead of remapping every dependency and then merging all the remapped jars into one, all dependencies are first merged into a single jar, after which that jar is remapped using the mappings of the project that does the remapping. This means that any subproject dependency that uses different mappings still get remapped with the mappings of the remapping project which is especially an issue if subprojects are not built against the same Minecraft version as the remapping project as classes that were renamed and/or deleted simply do not get remapped causing NoClassDefFoundErrors when using the mod.

No `fabric_loader_version` property in Forge+Quilt template

Tried to use Forge+Quilt template but got an error
Could not get unknown property 'fabric_loader_version' for root project 'epicfightmod' of type org.gradle.api.Project

common/build.gradle, line 9

dependencies {
    // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
    // Do NOT use other classes from fabric loader
    modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" // Requires `fabric_loader_version` property
    // Remove the next line if you don't want to depend on the API
    modApi "dev.architectury:architectury:${rootProject.architectury_version}"
}

gradle.properties

minecraft_version=1.18.2
enabled_platforms=quilt,forge

archives_base_name=epicfight
mod_version=18.1.22
maven_group=com.yesman.epicfight

architectury_version=4.4.70

forge_version=1.18.2-40.1.51

quilt_loader_version=0.17.0
quilt_fabric_api_version=1.0.0-beta.19+0.55.1-1.18.2

Change 'mixins' to 'mixin' in quilt.mod.json and add examplemod.mixins.json to mixins module

The quilt.mod.json generated by these templates currently produces

{
...
  "mixins": [
    "examplemod.mixins.json",
    "examplemod-common.mixins.json"
  ],
...
}

however, quilt requires it to be mixin instead of mixins.

So instead, these templates should generate

{
...
  "mixin": [
    "examplemod.mixins.json",
    "examplemod-common.mixins.json"
  ],
...
}

Also, examplemod.mixins.json isn't generated by the templates either in the quilt module, so that should also be fixed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.