Skip to content

Commit

Permalink
Merge pull request #5 from ImUrX/dev
Browse files Browse the repository at this point in the history
update to 1.18.2
  • Loading branch information
ImUrX authored May 22, 2022
2 parents 6b9f71b + 8c9439a commit 374f28d
Show file tree
Hide file tree
Showing 18 changed files with 226 additions and 33 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.10.0-SNAPSHOT" apply false
id "dev.architectury.loom" version "0.11.0-SNAPSHOT" apply false
}

architectury {
Expand All @@ -10,16 +10,16 @@ architectury {
subprojects {
apply plugin: "dev.architectury.loom"

/*loom {
loom {
silentMojangMappingsLicense()
}*/
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
// mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
mappings "net.fabricmc:yarn:1.18+build.1:v2"
mappings "net.fabricmc:yarn:1.18.2+build.3:v2"

implementation "io.github.imurx:arboard:${rootProject.arboard_version}"
}
Expand Down
8 changes: 4 additions & 4 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
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
Expand All @@ -9,10 +13,6 @@ dependencies {
}
}

architectury {
common()
}

publishing {
publications {
mavenCommon(MavenPublication) {
Expand Down
12 changes: 12 additions & 0 deletions fabric-like/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
architectury {
common(rootProject.enabled_platforms.split(","))
}

dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"

compileClasspath(project(path: ":common", configuration: "namedElements")) { transitive false }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.github.imurx.screenshotcopy.fabriclike;

import io.github.imurx.screenshotcopy.fabriclike.ScreenshotCopyFabricLike;

public class ScreenshotCopyFabricLike {
public static void init() {

}
}
6 changes: 6 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ configurations {
dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"

// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") {
Expand All @@ -30,6 +31,8 @@ dependencies {
include "io.github.imurx:arboard:${rootProject.arboard_version}"
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
common(project(path: ":fabric-like", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":fabric-like", configuration: "transformProductionFabric")) { transitive false }
}

processResources {
Expand All @@ -41,11 +44,14 @@ processResources {
}

shadowJar {
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}

remapJar {
injectAccessWidener = true
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ public void onInitializeClient() {

private void initFabrishot() {
FramebufferCaptureCallback.EVENT.register((dimension, byteBuffer) -> {
byte[] array = new byte[dimension.height * dimension.width * 4];
byte[] array = new byte[dimension.height() * dimension.width() * 4];
//im sure there is a better way but no idea
for (int i = 0; i < byteBuffer.capacity(); i+=3) {
for(int j = 0; j < 3; j++) array[i+j] = byteBuffer.get(j+i);
array[i+3] = -1;
int offset = 0;
for (int i = 0; i < byteBuffer.capacity(); i++) {
if(i % 3 == 0 && i != 0) {
array[i+offset] = -1;
offset++;
}
array[offset+i] = byteBuffer.get(i);
}
ScreenshotCopy.copyScreenshot(dimension.width, dimension.height, array);
ScreenshotCopy.copyScreenshot(dimension.width(), dimension.height(), array);
});
}
}
5 changes: 2 additions & 3 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
},
"mixins": ["screencopy.mixins.json"],
"depends": {
"fabricloader": ">=0.9.0",
"minecraft": ">=1.18",
"cloth-config": ">=6.1.48",
"minecraft": ">=1.18.2",
"cloth-config": ">=6.2.62",
"fabric-lifecycle-events-v1": "*",
"fabric-resource-loader-v0": "*"
},
Expand Down
3 changes: 1 addition & 2 deletions fabric/src/main/resources/screencopy.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
],
"injectors": {
"defaultRequire": 1
},
"minVersion": "0.8"
}
}
3 changes: 2 additions & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ processResources {

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}
Expand All @@ -55,7 +57,6 @@ sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

components.java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Mod(ScreenshotCopy.MOD_ID)
public class ScreenshotCopyForge {
public ScreenshotCopyForge() {
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (a, b) -> true));
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> "Client-side mod", (a, b) -> b));
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> this::client);
}

Expand Down
8 changes: 4 additions & 4 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[38,)"
loaderVersion = "[40,)"
issueTrackerURL = "https://github.com/ImUrX/screencopy/issues"
license = "MIT OR Apache-2.0"

Expand All @@ -18,20 +18,20 @@ logoFile = "icon.png"
[[dependencies.screencopy]]
modId = "forge"
mandatory = true
versionRange = "[38,)"
versionRange = "[40,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.screencopy]]
modId = "minecraft"
mandatory = true
versionRange = "[1.18,)"
versionRange = "[1.18.2,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.screencopy]]
modId = "cloth_config"
mandatory = true
versionRange = "[6.1.48,)"
versionRange = "[6.2.62,)"
ordering = "NONE"
side = "CLIENT"
22 changes: 13 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
org.gradle.jvmargs=-Xmx2048M

minecraft_version=1.18
minecraft_version=1.18.2
enabled_platforms=quilt,fabric,forge

archives_base_name=screenshotcopy
mod_version=1.0.0
mod_version=1.1.0
maven_group=io.github.imurx

cloth_config_version=6.1.48
arboard_version=1.0.2
cloth_config_version=6.2.62
arboard_version=1.1.0

fabric_loader_version=0.12.12
fabric_api_version=0.46.1+1.18
mod_menu_version=3.0.1
fabrishot_version=1.6.0
fabric_loader_version=0.14.6
fabric_api_version=0.53.0+1.18.2
mod_menu_version=3.2.2
fabrishot_version=1.7.0

forge_version=1.18-38.0.17
forge_version=1.18.2-40.1.19

quilt_loader_version=0.16.0
quilt_fabric_api_version=1.0.0-beta.13+0.51.1-1.18.2
90 changes: 90 additions & 0 deletions quilt/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}

repositories {
maven { url "https://maven.quiltmc.org/repository/release/" }
}

architectury {
platformSetupLoomIde()
loader("quilt")
}

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
developmentQuilt.extendsFrom common
}

dependencies {
modImplementation "org.quiltmc:quilt-loader:${rootProject.quilt_loader_version}"
modApi "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilt_fabric_api_version}"
// Remove the next few lines if you don't want to depend on the API
/*modApi("dev.architectury:architectury-fabric:${rootProject.architectury_version}") {
// We must not pull Fabric Loader from Architectury Fabric
exclude group: "net.fabricmc"
exclude group: "net.fabricmc.fabric-api"
}*/

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionQuilt")) { transitive false }
common(project(path: ":fabric-like", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":fabric-like", configuration: "transformProductionQuilt")) { transitive false }
}

processResources {
inputs.property "group", rootProject.maven_group
inputs.property "version", project.version

filesMatching("quilt.mod.json") {
expand "group": rootProject.maven_group,
"version": project.version
}
}

shadowJar {
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}

remapJar {
injectAccessWidener = true
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}

jar {
classifier "dev"
}

sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

publishing {
publications {
mavenQuilt(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.
}
}
1 change: 1 addition & 0 deletions quilt/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform=quilt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.github.imurx.screenshotcopy.fabric;

import org.quiltmc.loader.api.QuiltLoader;

import java.nio.file.Path;

public class ExampleExpectPlatformImpl {
/**
* This is our actual method to {@link ExampleExpectPlatform#getConfigDirectory()}.
*/
public static Path getConfigDirectory() {
return QuiltLoader.getConfigDir();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.github.imurx.screenshotcopy.quilt;

import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;

public class ExampleModQuilt implements ModInitializer {
@Override
public void onInitialize(ModContainer mod) {

}
}
41 changes: 41 additions & 0 deletions quilt/src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"schema_version": 1,
"quilt_loader": {
"group": "${group}",
"id": "examplemod",
"version": "${version}",
"name": "Example Mod",
"description": "This is an example description! Tell everyone what your mod is about!",
"authors": ["Me!"],
"contact": {
"sources": "https://github.com/architectury/architectury-templates"
},
"license": "Insert License Here",
"icon": "assets/examplemod/icon.png",
"intermediate_mappings": "net.fabricmc:intermediary",
"environment": "*",
"entrypoints": {
"init": [
"net.examplemod.quilt.ExampleModQuilt"
]
},
"depends": [
{
"id": "quilt_loader",
"version": "*"
},
{
"id": "quilt_base",
"version": "*"
},
{
"id": "minecraft",
"version": ">=1.18.2"
},
{
"id": "architectury",
"version": ">=4.4.59"
}
]
}
}
Loading

0 comments on commit 374f28d

Please sign in to comment.