-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from TexBlock/arch/1.19.3
[1.19.3]Port to Architectury
- Loading branch information
Showing
24 changed files
with
420 additions
and
180 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,19 @@ | ||
# gradle | ||
|
||
.gradle/ | ||
build/ | ||
out/ | ||
classes/ | ||
|
||
# eclipse | ||
|
||
*.launch | ||
|
||
# idea | ||
|
||
.idea/ | ||
*.iml | ||
*.ipr | ||
run/ | ||
*.iws | ||
|
||
# vscode | ||
|
||
.settings/ | ||
.vscode/ | ||
out/ | ||
*.iml | ||
.gradle/ | ||
output/ | ||
bin/ | ||
libs/ | ||
|
||
.classpath | ||
.project | ||
|
||
# macos | ||
|
||
*.DS_Store | ||
|
||
# fabric | ||
|
||
run/ | ||
|
||
# java | ||
|
||
hs_err_*.log | ||
replay_*.log | ||
*.hprof | ||
*.jfr | ||
.idea/ | ||
classes/ | ||
.metadata | ||
.vscode | ||
.settings | ||
*.launch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,50 @@ | ||
plugins { | ||
id 'fabric-loom' version '1.2-SNAPSHOT' | ||
id 'maven-publish' | ||
} | ||
|
||
archivesBaseName = "${project.archives_base_name}-${project.minecraft_version}" | ||
version = project.mod_version | ||
group = project.maven_group | ||
|
||
repositories { | ||
maven { url 'https://api.modrinth.com/maven' } | ||
} | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
|
||
compileOnly "maven.modrinth:splasher:${project.minecraft_version}-${project.splasher_version}" | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
it.options.release = Integer.parseInt(sourceCompatibility) | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
|
||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
jar { | ||
from("LICENSE") { | ||
rename { "${it}_${project.archivesBaseName}"} | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
|
||
repositories { | ||
} | ||
id "architectury-plugin" version "3.4-SNAPSHOT" | ||
id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false | ||
} | ||
|
||
architectury { | ||
minecraft = rootProject.minecraft_version | ||
} | ||
|
||
subprojects { | ||
apply plugin: "dev.architectury.loom" | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||
} | ||
} | ||
|
||
allprojects { | ||
apply plugin: "java" | ||
apply plugin: "architectury-plugin" | ||
apply plugin: "maven-publish" | ||
|
||
archivesBaseName = rootProject.archives_base_name | ||
version = "${rootProject.minecraft_version}-${rootProject.mod_version}" | ||
group = rootProject.maven_group | ||
|
||
repositories { | ||
exclusiveContent { | ||
forRepository { | ||
maven { | ||
name = "Modrinth" | ||
url = "https://api.modrinth.com/maven" | ||
} | ||
} | ||
filter { | ||
includeGroup "maven.modrinth" | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
options.release = 17 | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
architectury { | ||
common(rootProject.enabled_platforms.split(",")) | ||
} | ||
|
||
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}" | ||
modApi "dev.architectury:architectury:${rootProject.architectury_version}" | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenCommon(MavenPublication) { | ||
artifactId = rootProject.archives_base_name | ||
from components.java | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
plugins { | ||
id "com.github.johnrengelman.shadow" version "7.1.2" | ||
} | ||
|
||
architectury { | ||
platformSetupLoomIde() | ||
fabric() | ||
} | ||
|
||
project.archivesBaseName = rootProject.archivesBaseName + "-fabric" | ||
|
||
configurations { | ||
common | ||
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. | ||
compileClasspath.extendsFrom common | ||
runtimeClasspath.extendsFrom common | ||
developmentFabric.extendsFrom common | ||
} | ||
|
||
dependencies { | ||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" | ||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" | ||
modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" | ||
|
||
compileOnly "maven.modrinth:splasher:${project.minecraft_version}-${project.splasher_version}" | ||
|
||
common(project(path: ":common", configuration: "namedElements")) { transitive false } | ||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
} | ||
|
||
shadowJar { | ||
exclude "architectury.common.json" | ||
|
||
configurations = [project.configurations.shadowCommon] | ||
archiveClassifier.set("dev-shadow") | ||
} | ||
|
||
remapJar { | ||
input.set shadowJar.archiveFile | ||
dependsOn shadowJar | ||
archiveClassifier.set(null) | ||
} | ||
|
||
jar { | ||
archiveClassifier.set("dev") | ||
} | ||
|
||
sourcesJar { | ||
def commonSources = project(":common").sourcesJar | ||
dependsOn commonSources | ||
from commonSources.archiveFile.map { zipTree(it) } | ||
} | ||
|
||
components.java { | ||
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { | ||
skip() | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenFabric(MavenPublication) { | ||
artifactId = rootProject.archives_base_name + "-" + project.name | ||
from components.java | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
fabric/src/main/java/net/krlite/bounced/fabric/BouncedClientFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package net.krlite.bounced.fabric; | ||
|
||
import dev.architectury.event.EventResult; | ||
import dev.architectury.event.events.client.ClientGuiEvent; | ||
import dev.architectury.event.events.client.ClientScreenInputEvent; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.krlite.bounced.Bounced; | ||
import net.krlite.splasher.Splasher; | ||
import net.minecraft.client.gui.screen.TitleScreen; | ||
|
||
public class BouncedClientFabric implements ClientModInitializer { | ||
@Override | ||
public void onInitializeClient() { | ||
ClientGuiEvent.INIT_POST.register((screen, screenAccess) -> { | ||
if (screen instanceof TitleScreen) { | ||
ClientScreenInputEvent.MOUSE_CLICKED_POST.register((client, currentScreen, mouseX, mouseY, button) -> { | ||
double scaledWidth = screenAccess.getScreen().width; | ||
double centerX = scaledWidth / 2.0, y = 30, width = 310, height = 44; | ||
if (!Bounced.isIntro() | ||
&& mouseX >= centerX - width / 2 && mouseX <= centerX + width / 2 | ||
&& mouseY >= y && mouseY <= y + height | ||
) { | ||
|
||
if (!Bounced.isSplasherLoaded || !Splasher.isMouseHovering(scaledWidth, mouseX, mouseY)) { | ||
// Linkage with Splasher | ||
Bounced.push(); | ||
} | ||
|
||
} | ||
return EventResult.pass(); | ||
}); | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.