diff --git a/.travis.yml b/.travis.yml index 48f42630..d413e5b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: java install: true jdk: - - oraclejdk8 + - openjdk8 before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ diff --git a/README.md b/README.md index df01e466..1137c928 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ http://minelittlepony-mod.com ## Building -1. JDK 8 is required. Install it using https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jdk_install.html +1. JDK 8 is required. Install it using https://adoptopenjdk.net/ 2. Open a terminal window in the same directory as the sources (git clone or extracted from zip). Run the following command (windows). diff --git a/build.gradle b/build.gradle index 2d388b97..1f764a5e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,37 +1,46 @@ +// Frabric build script +// 24/05/2019 +// https://github.com/FabricMC/fabric-example-mod/blob/master/build.gradle + buildscript { - repositories { - jcenter() - maven { - name 'forge' - url 'http://files.minecraftforge.net/maven' - } - maven { - name = 'sponge' - url = 'https://repo.spongepowered.org/maven' - } - } + repositories { + jcenter() + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + gradlePluginPortal() + } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' - classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' + classpath 'fabric-loom:fabric-loom.gradle.plugin:0.2.2-SNAPSHOT' + classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' + classpath 'org.ajoberstar.grgit:grgit-gradle:3.1.1' } } -plugins { - id 'org.ajoberstar.grgit' version '1.7.2' +repositories { + maven { + name = 'Jit' + url = 'https://jitpack.io' + } } -apply plugin: 'net.minecraftforge.gradle.liteloader' -apply plugin: 'org.spongepowered.mixin' +apply plugin: 'fabric-loom' apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'org.ajoberstar.grgit' + +targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_1_8 ext { - revision = grgit.log().size() - hash = grgit.head().abbreviatedId - if (file('.git/shallow').exists()) { - // don't clone with --depth - revision = -1 - hash += " shallow" + if (grgit == null) { + revision = "nogit" + } else { + revision = "${grgit.log().size()}-${grgit.head().abbreviatedId}" + if (file('.git/shallow').exists()) { + // don't clone with --depth + revision = "-1-${shallow}" + } } } @@ -41,83 +50,64 @@ if (project.release != 'RELEASE') { version += "-${project.release}" } if (project.release == 'SNAPSHOT') { - version += "-${project.revision}-${project.hash}" + version += "-${project.revision}" } group = project.group description = project.displayname - -minecraft { - version = project.minecraft_version - mappings = project.mappings_version - runDir = 'run' - replace '@VERSION@', project.version -} - -mixin { - defaultObfuscationEnv notch -} - -targetCompatibility = 1.8 -sourceCompatibility = 1.8 -sourceSets { - hdskins { - compileClasspath += main.compileClasspath - ext.refMap = 'hdskins.mixin.refmap.json' - } - main { - compileClasspath += hdskins.output - ext.refMap = 'minelp.mixin.refmap.json' - } -} +archivesBaseName = project.name dependencies { - // use the same version as httpclient - compile('org.apache.httpcomponents:httpmime:4.3.2') { - transitive = false - } - compile('org.spongepowered:mixin:0.7.11-SNAPSHOT') { - transitive = false - } + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}" + modCompile "net.fabricmc:fabric-loader:${project.loader_version}" + compileOnly "com.google.code.findbugs:jsr305:3.0.2" + + modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + modCompile "com.github.MineLittlePony:Kirin:${project.kirin_version}" + include "com.github.MineLittlePony:Kirin:${project.kirin_version}" + + // TODO: HD Skins can be made optional later + modCompile "com.github.MineLittlePony:HDSkins:${project.hd_skins_version}" + include "com.github.MineLittlePony:HDSkins:${project.hd_skins_version}" } -manifest { - attributes 'Implementation-Version': "${project.version} (git-${project.hash})" +processResources { + inputs.property "version", project.version + + from(sourceSets.main.resources.srcDirs) { + include "fabric.mod.json" + expand "version": project.version + } + + from(sourceSets.main.resources.srcDirs) { + exclude "fabric.mod.json" + } } -litemod.json { - mcversion = project.minecraft_version - displayName = project.displayname - author = project.authors - revision = project.revision - description = project.description - description.minelittlepony = project.description_mlp - description.hdskinsmod = project.description_hd - mixinConfigs += [ - 'minelp.mixin.json', - 'hdskins.mixin.json' - ] +tasks.withType(JavaCompile) { + options.encoding = "UTF-8" } -archivesBaseName = "mod-${project.name.toLowerCase()}" -afterEvaluate { - file('build.number').delete() +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = "sources" + from sourceSets.main.allSource } jar { - from sourceSets.hdskins.output - from litemod - classifier 'base' - extension 'jar' + from "LICENSE" } +// +// Imports the Background Ponies from the MLP Community Skin Pack +// task copyBGPones(type: Copy) { def illegals = /[^a-z0-9_\/.-]/ from "skins/Background Ponies" - // TODO: What is tempDir???? into temporaryDir eachFile { @@ -127,47 +117,3 @@ task copyBGPones(type: Copy) { } } } - -shadowJar { - extension 'litemod' - classifier "mc$minecraft.version" - - from sourceSets.hdskins.output - from litemod - - exclude "/assets/minelittlepony/textures/entity/pony" - from(copyBGPones) { - into "/assets/minelittlepony/textures/entity/pony" - } - - dependencies { - exclude dependency('deobf.com.mumfrey:liteloader:') - exclude dependency('deobf.org.ow2.asm:') - exclude dependency('org.spongepowered:mixin:') - exclude 'META-INF/**' - } - - relocate 'org.apache.http.entity.mime', 'com.voxelmodpack.repack.org.apache.http.entity.mime' - exclude 'dummyThing' - doLast { - file('build/libs/' + archivesBaseName + '-' + version + '-base.jar').delete(); - } -} - -task srgJar(type: Jar) { - from sourceSets.main.output - from sourceSets.hdskins.output - from litemod - - classifier "mc$minecraft.version-srg" -} - -sourceJar.enabled = false - -reobf { - srgJar { - mappingType = 'SEARGE' - } - - shadowJar{} -} diff --git a/code_cleanup.xml b/code_cleanup.xml new file mode 100644 index 00000000..1469fa23 --- /dev/null +++ b/code_cleanup.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code_style.xml b/code_style.xml new file mode 100644 index 00000000..8cec298c --- /dev/null +++ b/code_style.xml @@ -0,0 +1,355 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradle.properties b/gradle.properties index 395ad38e..463d5d1d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,22 @@ -group=com.minelittlepony -displayname=Mine Little Pony -authors=Verdana, Rene_Z, Mumfrey, Killjoy1221, Sollace -description=Mine Little Pony turns players and mobs into ponies -description_mlp=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings. -description_hd=Separate skin server for Mine Little Pony that also supports HD skins. Access via button on the main menu. -version=3.2.1 -release=SNAPSHOT -minecraft_version=1.12.2 -mappings_version=stable_39 +org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false + +# Fabric Properties + # check these on https://fabricmc.net/use + minecraft_version=1.14.1 + yarn_mappings=1.14.1+build.5 + loader_version=0.4.7+build.147 + +# Mod Properties + group=com.minelittlepony + displayname=Mine Little Pony + authors=Verdana, Rene_Z, Mumfrey, Killjoy1221, Sollace + description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings. + version=3.2.1 + release=SNAPSHOT + +# Dependencies + # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric + fabric_version=0.3.0-pre+build.156 + kirin_version=1.14-fabric-SNAPSHOT + hd_skins_version=1.14-fabric-SNAPSHOT diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 758de960..7a3265ee 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2d80b69a..1ac0eef4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Mon Apr 15 20:00:20 CAT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip diff --git a/src/api/java/mcp/MethodsReturnNonnullByDefault.java b/src/api/java/mcp/MethodsReturnNonnullByDefault.java deleted file mode 100644 index fb02ffca..00000000 --- a/src/api/java/mcp/MethodsReturnNonnullByDefault.java +++ /dev/null @@ -1,26 +0,0 @@ -package mcp; - -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierDefault; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * This annotation can be applied to a package, class or method to indicate that - * the method in that element are nonnull by default unless there is: - * - * - */ -@Documented -@Nonnull -@TypeQualifierDefault(ElementType.METHOD) // Note: This is a copy of javax.annotation.ParametersAreNonnullByDefault with target changed to METHOD -@Retention(RetentionPolicy.RUNTIME) -public @interface MethodsReturnNonnullByDefault {} diff --git a/src/api/java/net/minecraftforge/client/ForgeHooksClient.java b/src/api/java/net/minecraftforge/client/ForgeHooksClient.java deleted file mode 100644 index 97899be4..00000000 --- a/src/api/java/net/minecraftforge/client/ForgeHooksClient.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.minecraftforge.client; - -import net.minecraft.client.model.ModelBiped; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.inventory.EntityEquipmentSlot; -import net.minecraft.item.ItemStack; - -// stub -public class ForgeHooksClient { - - public static String getArmorTexture(Entity entity, ItemStack armor, String def, EntityEquipmentSlot slot, String type) { - return def; - } - - public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) { - return def; - } - -} diff --git a/src/hdskins/java/com/minelittlepony/gui/Button.java b/src/hdskins/java/com/minelittlepony/gui/Button.java deleted file mode 100644 index bd30d290..00000000 --- a/src/hdskins/java/com/minelittlepony/gui/Button.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.minelittlepony.gui; - -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; - -public class Button extends GuiButton implements IGuiTooltipped