diff --git a/build.gradle b/build.gradle index 3a1a350f..1e13db20 100644 --- a/build.gradle +++ b/build.gradle @@ -1,106 +1,85 @@ -buildscript { - repositories { - jcenter() - maven { - name 'forge' - url 'http://files.minecraftforge.net/maven/' - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - maven { - name = 'sponge' - url = 'http://repo.spongepowered.org/maven' - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:' + project.forgeGradleVersion - } +// Fabric build script +// 03/06/2019 +// https://github.com/FabricMC/fabric-example-mod/blob/master/build.gradle + +plugins { + id 'java-library' + id 'fabric-loom' version '0.2.5-SNAPSHOT' + id 'maven-publish' } -apply plugin: 'net.minecraftforge.gradle.forge' -def ver = "${project.buildType}${project.buildVersion}.${project.buildRevision}" +targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_1_8 + +version = "${project.minecraft_version}-${project.version}" + +if (project.release != 'RELEASE') { + version += "-${project.release}" +} -version = ver group = project.group -description = project.description +description = project.displayname +archivesBaseName = project.name minecraft { - version = project.mcVersion + '-' + project.mcfVersion - mappings = project.mcMappings - runDir = 'run' - replace '@MODID@', project.modid - replace '@NAME@', project.name - replace '@AUTHOR@', project.author - replace '@VERSION@', ver - replace '@DESCRIPTION@', project.description -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -sourceSets { - jei { - compileClasspath += main.compileClasspath - compileClasspath += main.output - } - external { - compileClasspath += main.compileClasspath - } - main { - compileClasspath += external.output - ext.refMap = project.refCore - } + refmapName = 'unicopia.mixin.refmap.json' } repositories { - flatDir { - dir 'lib' - } - maven { - // location of the maven that hosts JEI files - name = "Progwml6 maven" - url = "http://dvs1.progwml6.com/files/maven" - } - maven { - // location of a maven mirror for JEI files, as a fallback - name = "ModMaven" - url = "modmaven.k-4u.nl" - } + maven { + name = 'minelp' + url = 'http://repo.minelittlepony-mod.com/maven/snapshot' + } + maven { + name = 'minelp-release' + url = 'http://repo.minelittlepony-mod.com/maven/release' + } } + +// check for updates every build when on CI +if (System.env.CI) { + configurations.all { + resolutionStrategy.cacheChangingModulesFor 0, 'seconds' + } +} + dependencies { - deobfCompile('com.minelittlepony:jumpingcastle:1.12.2.1.0.0:universal') - // compile against the JEI API but do not include it at runtime - deobfProvided "mezz.jei:jei_${project.mcVersion}:${project.jeiVersion}:api" - // at runtime, use the full JEI jar - runtime "mezz.jei:jei_${project.mcVersion}:${project.jeiVersion}" + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}" + modApi "net.fabricmc:fabric-loader:${project.loader_version}" + + compileOnly "com.google.code.findbugs:jsr305:3.0.2" + + //modApi "net.fabricmc.fabric-api:fabric-api-base:0.1.0+" + //modApi "net.fabricmc.fabric-api:fabric-events-lifecycle-v0:0.1.0+" + //modApi "net.fabricmc.fabric-api:fabric-resource-loader-v0:0.1.0+" + + modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + modApi "com.minelittlepony:Kirin:${project.kirin_version}" + include "com.minelittlepony:Kirin:${project.kirin_version}" + + modImplementation "io.github.prospector.modmenu:ModMenu:1.6.2-93" } processResources { - def props = [ - modid: project.modid, - name: project.title, - description: project.description, - version: ver, - revision: project.buildRevision, - mcversion: project.mcVersion, - author: project.author - ] + inputs.property "version", project.version - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - expand props - } + from(sourceSets.main.resources.srcDirs) { + include "fabric.mod.json" + expand "version": project.version + } - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } + from(sourceSets.main.resources.srcDirs) { + exclude "fabric.mod.json" + } } -jar { - from sourceSets.main.output - from sourceSets.external.output - from sourceSets.jei.output - baseName = "Unicopia-mc${project.mcVersion}" +tasks.withType(JavaCompile) { + options.encoding = "UTF-8" +} + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = "sources" + from sourceSets.main.allSource } diff --git a/gradle.properties b/gradle.properties index 67f7ce43..82cefea0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,15 +1,20 @@ -modid=unicopia -title=Unicopia Redux -group=com.minelittlepony.unicopia -author=Sollace -description=Magical Abilities for Mine Little Pony! -buildType=inDev -buildVersion=2 -buildRevision=11 -mcVersion=1.12.2 -mcfVersion=14.23.5.2824 -jeiVersion=4.15.0.268 -mcMappings=stable_39 -refCore=mixins.unicopia.refmap.json -forgeGradleVersion=2.3-SNAPSHOT -mixinGradleVersion=0.6-SNAPSHOT +org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false + +# Fabric Properties + # check these on https://fabricmc.net/use + minecraft_version=1.14.4 + yarn_mappings=1.14.4+build.2 + loader_version=0.4.8+ + +# Mod Properties + group=com.minelittlepony + displayname=Unicopia Redux + authors=Sollace + description=Magical Abilities for Mine Little Pony! + version=3 + release=SNAPSHOT + +# Dependencies + fabric_version=0.3.0+ + kirin_version=1.14.4-1.4.4 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/lib/jumpingcastle-1.12.2.1.0.0-universal.jar b/lib/jumpingcastle-1.12.2.1.0.0-universal.jar deleted file mode 100644 index d0392427..00000000 Binary files a/lib/jumpingcastle-1.12.2.1.0.0-universal.jar and /dev/null differ diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..a5a8746d --- /dev/null +++ b/settings.gradle @@ -0,0 +1,11 @@ +pluginManagement { + repositories { + jcenter() + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + gradlePluginPortal() + } +} +rootProject.name = 'Unicopia' diff --git a/src/api/java/baubles/api/BaubleType.java b/src/api/java/baubles/api/BaubleType.java deleted file mode 100644 index 06fa86f2..00000000 --- a/src/api/java/baubles/api/BaubleType.java +++ /dev/null @@ -1,14 +0,0 @@ -package baubles.api; - -import org.apache.commons.lang3.NotImplementedException; - -/* - * stub - */ -public enum BaubleType { - AMULET, RING, BELT, TRINKET, HEAD, BODY, CHARM; - - public int[] getValidSlots() { - throw new NotImplementedException("getValidSlots"); - } -} diff --git a/src/api/java/baubles/api/BaublesApi.java b/src/api/java/baubles/api/BaublesApi.java deleted file mode 100644 index 9d0b3d66..00000000 --- a/src/api/java/baubles/api/BaublesApi.java +++ /dev/null @@ -1,20 +0,0 @@ -package baubles.api; - -import org.apache.commons.lang3.NotImplementedException; - -import baubles.api.cap.IBaublesItemHandler; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; - -/* - * stub - */ -public class BaublesApi { - public static IBaublesItemHandler getBaublesHandler(EntityPlayer player) { - throw new NotImplementedException("getBaublesHandler"); - } - - public static int isBaubleEquipped(EntityPlayer player, Item bauble) { - throw new NotImplementedException("isBaubleEquipped"); - } -} diff --git a/src/api/java/baubles/api/IBauble.java b/src/api/java/baubles/api/IBauble.java deleted file mode 100644 index 4694c968..00000000 --- a/src/api/java/baubles/api/IBauble.java +++ /dev/null @@ -1,60 +0,0 @@ -package baubles.api; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -/** - * - * This interface should be extended by items that can be worn in bauble slots - * - * @author Azanor - */ -public interface IBauble { - - /** - * This method return the type of bauble this is. - * Type is used to determine the slots it can go into. - */ - public BaubleType getBaubleType(ItemStack itemstack); - - /** - * This method is called once per tick if the bauble is being worn by a player - */ - public default void onWornTick(ItemStack itemstack, EntityLivingBase player) { - } - - /** - * This method is called when the bauble is equipped by a player - */ - public default void onEquipped(ItemStack itemstack, EntityLivingBase player) { - } - - /** - * This method is called when the bauble is unequipped by a player - */ - public default void onUnequipped(ItemStack itemstack, EntityLivingBase player) { - } - - /** - * can this bauble be placed in a bauble slot - */ - public default boolean canEquip(ItemStack itemstack, EntityLivingBase player) { - return true; - } - - /** - * Can this bauble be removed from a bauble slot - */ - public default boolean canUnequip(ItemStack itemstack, EntityLivingBase player) { - return true; - } - - /** - * Will bauble automatically sync to client if a change is detected in its NBT or damage values? - * Default is off, so override and set to true if you want to auto sync. - * This sync is not instant, but occurs every 10 ticks (.5 seconds). - */ - public default boolean willAutoSync(ItemStack itemstack, EntityLivingBase player) { - return false; - } -} diff --git a/src/api/java/baubles/api/cap/IBaublesItemHandler.java b/src/api/java/baubles/api/cap/IBaublesItemHandler.java deleted file mode 100644 index a7a0e36c..00000000 --- a/src/api/java/baubles/api/cap/IBaublesItemHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package baubles.api.cap; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraftforge.items.IItemHandlerModifiable; - -/* - * stub - */ -public interface IBaublesItemHandler extends IItemHandlerModifiable { - boolean isItemValidForSlot(int slot, ItemStack stack, EntityLivingBase player); -} diff --git a/src/api/java/com/minelittlepony/MineLittlePony.java b/src/api/java/com/minelittlepony/MineLittlePony.java deleted file mode 100644 index b9be83f2..00000000 --- a/src/api/java/com/minelittlepony/MineLittlePony.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.minelittlepony; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public abstract class MineLittlePony { - public static MineLittlePony getInstance() { - throw new RuntimeException(); - } -} diff --git a/src/api/java/com/minelittlepony/pony/data/IPony.java b/src/api/java/com/minelittlepony/pony/data/IPony.java deleted file mode 100644 index b1597170..00000000 --- a/src/api/java/com/minelittlepony/pony/data/IPony.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.minelittlepony.pony.data; - -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -// Stub -@SideOnly(Side.CLIENT) -public interface IPony { - - static IPony forPlayer(AbstractClientPlayer player) { - return null; - } - - PonyRace getRace(boolean ignorePony); - -} diff --git a/src/api/java/com/minelittlepony/pony/data/PonyRace.java b/src/api/java/com/minelittlepony/pony/data/PonyRace.java deleted file mode 100644 index a7ef4eca..00000000 --- a/src/api/java/com/minelittlepony/pony/data/PonyRace.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.minelittlepony.pony.data; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -// Stub -@SideOnly(Side.CLIENT) -public enum PonyRace { - HUMAN, - EARTH, - PEGASUS, - UNICORN, - ALICORN, - CHANGELING, - ZEBRA, - REFORMED_CHANGELING, - GRIFFIN, - HIPPOGRIFF, - BATPONY, - SEAPONY; - - public boolean hasHorn() { - return false; - } - - public boolean hasWings() { - return false; - } - - public boolean isHuman() { - return this == HUMAN; - } -} diff --git a/src/jei/java/com/minelittlepony/unicopia/jei/BlendedDrawable.java b/src/jei/java/com/minelittlepony/unicopia/jei/BlendedDrawable.java deleted file mode 100644 index 0036e00c..00000000 --- a/src/jei/java/com/minelittlepony/unicopia/jei/BlendedDrawable.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.minelittlepony.unicopia.jei; - -import mezz.jei.api.gui.IDrawable; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; - -class BlendedDrawable implements IDrawable { - - private final IDrawable wrapped; - - public BlendedDrawable(IDrawable wrapped) { - this.wrapped = wrapped; - } - - @Override - public int getWidth() { - return wrapped.getWidth(); - } - - @Override - public int getHeight() { - return wrapped.getHeight(); - } - - @Override - public void draw(Minecraft minecraft, int xOffset, int yOffset) { - GlStateManager.enableBlend(); - wrapped.draw(minecraft, xOffset, yOffset); - GlStateManager.disableBlend(); - } - -} diff --git a/src/jei/java/com/minelittlepony/unicopia/jei/JEIUnicopia.java b/src/jei/java/com/minelittlepony/unicopia/jei/JEIUnicopia.java deleted file mode 100644 index 3ea7682b..00000000 --- a/src/jei/java/com/minelittlepony/unicopia/jei/JEIUnicopia.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.minelittlepony.unicopia.jei; - -import com.minelittlepony.unicopia.Unicopia; -import com.minelittlepony.unicopia.enchanting.SpecialRecipe; -import com.minelittlepony.unicopia.enchanting.SpellRecipe; -import com.minelittlepony.unicopia.init.UItems; -import com.minelittlepony.unicopia.spell.SpellRegistry; - -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.IModPlugin; -import mezz.jei.api.IModRegistry; -import mezz.jei.api.ISubtypeRegistry; -import mezz.jei.api.JEIPlugin; -import mezz.jei.api.recipe.IRecipeCategoryRegistration; - -@JEIPlugin -public class JEIUnicopia implements IModPlugin { - - static IGuiHelper GUI_HELPER; - - static final String RECIPE_UID = "unicopia:spellbook_2"; - - @Override - public void registerItemSubtypes(ISubtypeRegistry registry) { - registry.registerSubtypeInterpreter(UItems.spell, SpellRegistry::getKeyFromStack); - registry.registerSubtypeInterpreter(UItems.curse, SpellRegistry::getKeyFromStack); - } - - @Override - public void registerCategories(IRecipeCategoryRegistration registry) { - registry.addRecipeCategories(new SpellbookCategory()); - } - - @Override - public void register(IModRegistry registry) { - GUI_HELPER = registry.getJeiHelpers().getGuiHelper(); - - registry.handleRecipes(SpellRecipe.class, SpellRecipeWrapper::new, RECIPE_UID); - registry.handleRecipes(SpecialRecipe.class, SpellRecipeWrapper::new, RECIPE_UID); - registry.addRecipes(Unicopia.getCraftingManager().getRecipes(), RECIPE_UID); - } -} diff --git a/src/jei/java/com/minelittlepony/unicopia/jei/SpellRecipeWrapper.java b/src/jei/java/com/minelittlepony/unicopia/jei/SpellRecipeWrapper.java deleted file mode 100644 index 66e77950..00000000 --- a/src/jei/java/com/minelittlepony/unicopia/jei/SpellRecipeWrapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.minelittlepony.unicopia.jei; - -import java.util.List; -import java.util.stream.Collectors; - -import com.minelittlepony.unicopia.enchanting.AbstractSpecialRecipe; - -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.item.ItemStack; - -public class SpellRecipeWrapper implements IRecipeWrapper { - - private final AbstractSpecialRecipe recipe; - - public SpellRecipeWrapper(AbstractSpecialRecipe recipe) { - this.recipe = recipe; - } - - public AbstractSpecialRecipe getRecipe() { - return recipe; - } - - @Override - public void getIngredients(IIngredients ingredients) { - - List> ingreds = recipe.getSpellIngredients().stream().map(ingredient -> { - return ingredient.getStacks().collect(Collectors.toList()); - }).collect(Collectors.toList()); - - ingredients.setInputLists(VanillaTypes.ITEM, ingreds); - - ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); - } - -} diff --git a/src/jei/java/com/minelittlepony/unicopia/jei/SpellbookCategory.java b/src/jei/java/com/minelittlepony/unicopia/jei/SpellbookCategory.java deleted file mode 100644 index b97ef241..00000000 --- a/src/jei/java/com/minelittlepony/unicopia/jei/SpellbookCategory.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.minelittlepony.unicopia.jei; - -import com.minelittlepony.unicopia.Unicopia; -import com.minelittlepony.unicopia.inventory.gui.GuiSpellBook; - -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeCategory; -import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.util.ResourceLocation; - -public class SpellbookCategory implements IRecipeCategory { - - @Override - public String getUid() { - return JEIUnicopia.RECIPE_UID; - } - - @Override - public String getTitle() { - return "Spellbook"; - } - - @Override - public IDrawable getIcon() { - return JEIUnicopia.GUI_HELPER.drawableBuilder( - new ResourceLocation(Unicopia.MODID, "textures/items/spellbook.png"), 0, 0, 16, 16) - .setTextureSize(16, 16) - .build(); - } - - @Override - public String getModName() { - return "Unicopia"; - } - - @Override - public IDrawable getBackground() { - return new BlendedDrawable( - JEIUnicopia.GUI_HELPER.drawableBuilder(GuiSpellBook.spellBookGuiTextures, 405, 0, 105, 108) - .setTextureSize(512, 256) - .build()); - } - - @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, @Deprecated IIngredients unused) { - recipeLayout.setShapeless(); - - IGuiItemStackGroup stacks = recipeLayout.getItemStacks(); - - stacks.init(0, true, 29, 3); - stacks.init(1, true, 3, 46); - stacks.init(2, true, 30, 86); - stacks.init(3, true, 80, 72); - stacks.init(4, true, 82, 15); - - stacks.init(5, false, 46, 44); - - stacks.set(unused); - - stacks.set(5, unused.getOutputs(VanillaTypes.ITEM).get(0)); - } -} diff --git a/src/main/java/com/minelittlepony/gui/Button.java b/src/main/java/com/minelittlepony/gui/Button.java deleted file mode 100644 index 57b5e4b4..00000000 --- a/src/main/java/com/minelittlepony/gui/Button.java +++ /dev/null @@ -1,64 +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