From 3e282d42ba438db5fd2c00c508cd2ae0f3b2be2b Mon Sep 17 00:00:00 2001 From: tyra314 Date: Wed, 7 Jul 2021 01:22:17 +0200 Subject: [PATCH] Updating build process --- build.gradle | 64 ++++++++++--------- gradle.properties | 8 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 1 - src/main/java/hunternif/mc/api/MarkerAPI.java | 13 ++-- .../api/client/impl/MarkerApiImplClient.java | 12 ++-- .../mc/impl/atlas/api/impl/MarkerApiImpl.java | 12 ++-- .../atlas/core/scaning/ITileDetector.java | 2 +- .../MixinCartographyTableScreenHandler.java | 3 +- 9 files changed, 60 insertions(+), 57 deletions(-) diff --git a/build.gradle b/build.gradle index 3ce857d82..b1c1bc743 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,5 @@ plugins { - id 'java-library' - id 'fabric-loom' version '0.5-SNAPSHOT' + id 'fabric-loom' version '0.7-SNAPSHOT' id 'maven-publish' } @@ -17,15 +16,15 @@ minecraft { repositories { maven { - url = "http://server.bbkr.space:8081/artifactory/libs-release" - } - maven { + // for fabric url = "https://maven.modmuss50.me/" } maven { + // for mod menu url = uri("https://jitpack.io") } maven { + // for cloth-config url = "https://maven.shedaniel.me/" } } @@ -45,40 +44,45 @@ dependencies { exclude(group: "net.fabricmc.fabric-api") } - compile 'com.google.code.findbugs:jsr305:3.0.2' - testCompile "junit:junit:4.+" +// compile 'com.google.code.findbugs:jsr305:3.0.2' +// testCompile "junit:junit:4.+" } processResources { inputs.property "version", project.version - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" - // add mod metadata + filesMatching("fabric.mod.json") { // add mod metadata expand "version": project.version } - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } } -// ensure that the encoding is set to UTF-8, no matter what the system default is -// this fixes some edge cases with special characters not displaying correctly -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html -tasks.withType(JavaCompile) { - options.encoding = "UTF-8" +tasks.withType(JavaCompile).configureEach { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too + // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. + // We'll use that if it's available, but otherwise we'll use the older option. + def targetVersion = 8 + if (JavaVersion.current().isJava9Compatible()) { + it.options.release = targetVersion + } } -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource +java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() } jar { - from "LICENSE" + from("LICENSE") { + rename { "${it}_${project.archivesBaseName}"} + } } // configure the maven publication @@ -86,7 +90,7 @@ publishing { publications { mavenJava(MavenPublication) { // add all the jars that should be included when publishing to maven - artifact(jar) { + artifact(remapJar) { builtBy remapJar } artifact(sourcesJar) { @@ -95,9 +99,11 @@ publishing { } } - // select the repositories you want to publish to + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { - // uncomment to publish to the local maven - // mavenLocal() + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. } } diff --git a/gradle.properties b/gradle.properties index 0a42b388a..96e060d05 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties minecraft_version = 1.16.5 yarn_mappings = 1.16.5+build.6 -loader_version = 0.11.3 +loader_version = 0.11.6 # Mod Properties mod_version = 6.0.0-fabric @@ -12,6 +12,6 @@ maven_group = hunternif.mc.atlas archives_base_name = antiqueatlas # Dependencies -cloth_config_version = 4.11.19 -fabric_version = 0.32.5+1.16 -mod_menu_version = 1.16.8 +cloth_config_version = 4.11.26 +fabric_version = 0.36.0+1.16 +mod_menu_version = 1.16.9 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d7..0f80bbf51 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 5b60df3d2..f91a4fe7e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,5 @@ pluginManagement { repositories { - jcenter() maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' diff --git a/src/main/java/hunternif/mc/api/MarkerAPI.java b/src/main/java/hunternif/mc/api/MarkerAPI.java index e84d15a67..a4a16a265 100644 --- a/src/main/java/hunternif/mc/api/MarkerAPI.java +++ b/src/main/java/hunternif/mc/api/MarkerAPI.java @@ -4,9 +4,8 @@ import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.world.World; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * API for putting custom markers to the atlases. Set the textures on the @@ -37,7 +36,7 @@ public interface MarkerAPI { * @return returns the marker. null if failed or client */ @Nullable - Marker putMarker(@Nonnull World world, boolean visibleAhead, int atlasID, Identifier marker, Text label, int x, int z); + Marker putMarker(@NotNull World world, boolean visibleAhead, int atlasID, Identifier marker, Text label, int x, int z); /** * Put a marker in all atlases in the world at specified block coordinates. @@ -53,7 +52,7 @@ public interface MarkerAPI { * @return returns the marker. null if failed or client */ @Nullable - Marker putGlobalMarker(@Nonnull World world, boolean visibleAhead, Identifier marker, Text label, int x, int z); + Marker putGlobalMarker(@NotNull World world, boolean visibleAhead, Identifier marker, Text label, int x, int z); /** * Delete a marker from an atlas. @@ -66,7 +65,7 @@ public interface MarkerAPI { * @param atlasID * @param markerID */ - void deleteMarker(@Nonnull World world, int atlasID, int markerID); + void deleteMarker(@NotNull World world, int atlasID, int markerID); /** * Delete a global marker from all atlases. Server side only! @@ -74,5 +73,5 @@ public interface MarkerAPI { * @param world * @param markerID */ - void deleteGlobalMarker(@Nonnull World world, int markerID); + void deleteGlobalMarker(@NotNull World world, int markerID); } diff --git a/src/main/java/hunternif/mc/impl/atlas/api/client/impl/MarkerApiImplClient.java b/src/main/java/hunternif/mc/impl/atlas/api/client/impl/MarkerApiImplClient.java index ea6ed9577..a0ea95f8a 100644 --- a/src/main/java/hunternif/mc/impl/atlas/api/client/impl/MarkerApiImplClient.java +++ b/src/main/java/hunternif/mc/impl/atlas/api/client/impl/MarkerApiImplClient.java @@ -10,34 +10,34 @@ import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; @Environment(EnvType.CLIENT) public class MarkerApiImplClient implements MarkerAPI { @Nullable @Override - public Marker putMarker(@Nonnull World world, boolean visibleAhead, int atlasID, Identifier marker, Text label, int x, int z) { + public Marker putMarker(@NotNull World world, boolean visibleAhead, int atlasID, Identifier marker, Text label, int x, int z) { new AddMarkerC2SPacket(atlasID, marker, x, z, visibleAhead, label).send(); return null; } @Nullable @Override - public Marker putGlobalMarker(@Nonnull World world, boolean visibleAhead, Identifier marker, Text label, int x, int z) { + public Marker putGlobalMarker(@NotNull World world, boolean visibleAhead, Identifier marker, Text label, int x, int z) { AntiqueAtlasMod.LOG.warn("Client tried to add a global marker"); return null; } @Override - public void deleteMarker(@Nonnull World world, int atlasID, int markerID) { + public void deleteMarker(@NotNull World world, int atlasID, int markerID) { new DeleteMarkerRequestC2SPacket(atlasID, markerID).send(); } @Override - public void deleteGlobalMarker(@Nonnull World world, int markerID) { + public void deleteGlobalMarker(@NotNull World world, int markerID) { AntiqueAtlasMod.LOG.warn("Client tried to delete a global marker"); } } diff --git a/src/main/java/hunternif/mc/impl/atlas/api/impl/MarkerApiImpl.java b/src/main/java/hunternif/mc/impl/atlas/api/impl/MarkerApiImpl.java index 9b3ccda1c..66c79effe 100644 --- a/src/main/java/hunternif/mc/impl/atlas/api/impl/MarkerApiImpl.java +++ b/src/main/java/hunternif/mc/impl/atlas/api/impl/MarkerApiImpl.java @@ -12,9 +12,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; public class MarkerApiImpl implements MarkerAPI { @@ -25,13 +25,13 @@ public class MarkerApiImpl implements MarkerAPI { @Nullable @Override - public Marker putMarker(@Nonnull World world, boolean visibleAhead, int atlasID, Identifier marker, Text label, int x, int z) { + public Marker putMarker(@NotNull World world, boolean visibleAhead, int atlasID, Identifier marker, Text label, int x, int z) { return doPutMarker(world, visibleAhead, atlasID, marker, label, x, z); } @Nullable @Override - public Marker putGlobalMarker(@Nonnull World world, boolean visibleAhead, Identifier marker, Text label, int x, int z) { + public Marker putGlobalMarker(@NotNull World world, boolean visibleAhead, Identifier marker, Text label, int x, int z) { return doPutMarker(world, visibleAhead, GLOBAL, marker, label, x, z); } @@ -50,12 +50,12 @@ private Marker doPutMarker(World world, boolean visibleAhead, int atlasID, Ident } @Override - public void deleteMarker(@Nonnull World world, int atlasID, int markerID) { + public void deleteMarker(@NotNull World world, int atlasID, int markerID) { doDeleteMarker(world, atlasID, markerID); } @Override - public void deleteGlobalMarker(@Nonnull World world, int markerID) { + public void deleteGlobalMarker(@NotNull World world, int markerID) { doDeleteMarker(world, GLOBAL, markerID); } diff --git a/src/main/java/hunternif/mc/impl/atlas/core/scaning/ITileDetector.java b/src/main/java/hunternif/mc/impl/atlas/core/scaning/ITileDetector.java index cae34339c..ab78afb05 100644 --- a/src/main/java/hunternif/mc/impl/atlas/core/scaning/ITileDetector.java +++ b/src/main/java/hunternif/mc/impl/atlas/core/scaning/ITileDetector.java @@ -3,8 +3,8 @@ import net.minecraft.util.Identifier; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; /** * Finds the biome ID to be used for a given chunk. diff --git a/src/main/java/hunternif/mc/impl/atlas/mixin/MixinCartographyTableScreenHandler.java b/src/main/java/hunternif/mc/impl/atlas/mixin/MixinCartographyTableScreenHandler.java index 6012f6f32..6925d646a 100644 --- a/src/main/java/hunternif/mc/impl/atlas/mixin/MixinCartographyTableScreenHandler.java +++ b/src/main/java/hunternif/mc/impl/atlas/mixin/MixinCartographyTableScreenHandler.java @@ -11,6 +11,7 @@ import net.minecraft.screen.slot.Slot; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -18,8 +19,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import javax.annotation.Nullable; - @Mixin(CartographyTableScreenHandler.class) public abstract class MixinCartographyTableScreenHandler extends ScreenHandler { @Shadow