diff --git a/build.gradle b/build.gradle index 656093c..e1375bf 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ buildscript { classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' } } + apply plugin: 'net.minecraftforge.gradle.forge' /* @@ -20,12 +21,15 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.1.0" +version = "1.2.0" group = "io.teammion.morefood" archivesBaseName = "tm-morefood" +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + minecraft { - version = "1.10.2-12.18.1.2014" + version = "1.10.2-12.18.1.2018" runDir = "run" // the mappings can be changed at any time, and must be in the following format. @@ -40,8 +44,8 @@ minecraft { dependencies { // you may put jars on which you depend on in ./libs // or you may define them like so.. -group = "io.teammion.morefood" -group = "io.teammion.morefood" + //compile "some.group:artifact:version:classifier" + //compile "some.group:artifact:version" // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env diff --git a/build.sh b/build.sh deleted file mode 100755 index b75d31b..0000000 --- a/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -# Update -npm run update - -# Executing gradlew -echo "Executing gradlew..." -./gradlew clean build diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7a0845d..231dfc4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Sat Jul 16 16:09:28 CEST 2016 +#Sat Jul 23 22:21:39 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/package.json b/package.json index 00a54ac..c92c619 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "tm-morefood", - "version": "1.1.0", + "version": "1.2.0", "description": "This Minecraft Mod will add additional food to Mincraft to provide a healthy variety.", "scripts": { - "setup": "./setup.sh", - "build": "./build.sh", - "update": "./update.sh", + "setup": "bin/setup", + "build": "bin/build", + "update": "bin/update", "client": "./gradlew runClient", "server": "./gradlew runServer" }, diff --git a/setup.sh b/setup.sh deleted file mode 100755 index f6e2855..0000000 --- a/setup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -# Update -npm run update - -# IDE to configure for -read -p "IDE to configure for: [idea|eclipse] " ide -if [ ! "${ide,,}" == "idea" ] && [ ! "${ide,,}" == "eclipse" ] -then - ide="" - echo "No valid IDE! No IDE will be configured." -fi - -# Executing gradlew -echo "Executing gradlew..." -JAVA_OPTS="-Xmx2g" ./gradlew setupDecompWorkspace $ide diff --git a/src/main/java/io/teammion/morefood/Config.java b/src/main/java/io/teammion/morefood/Config.java new file mode 100644 index 0000000..74abf2a --- /dev/null +++ b/src/main/java/io/teammion/morefood/Config.java @@ -0,0 +1,25 @@ +package io.teammion.morefood; + +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +import java.io.File; + +/** + * Created by Stefan Wimmer on 19.07.16. + */ +public class Config +{ + public static boolean OVERRIDE_BREAD_RECIPE; + + static void load(FMLPreInitializationEvent e) + { + Configuration config = new Configuration(e.getSuggestedConfigurationFile()); + + config.load(); + + OVERRIDE_BREAD_RECIPE = config.get("food", "override_bread_recipe", false).getBoolean(); + + config.save(); + } +} diff --git a/src/main/java/io/teammion/morefood/CreativeTabs.java b/src/main/java/io/teammion/morefood/CreativeTabs.java index 12fef58..c93b38e 100644 --- a/src/main/java/io/teammion/morefood/CreativeTabs.java +++ b/src/main/java/io/teammion/morefood/CreativeTabs.java @@ -3,53 +3,22 @@ import net.minecraft.item.Item; /** - * Created by Stefan Wimmer on 05.06.16. + * Created by Stefan Wimmer on 23.07.16. */ -public abstract class CreativeTabs extends net.minecraft.creativetab.CreativeTabs +public class CreativeTabs extends net.minecraft.creativetab.CreativeTabs { - // public static final CreativeTabs MOREFOOD_ITEMS = new Impl("morefood_items", Items.COCOA_BEAN_GROUND); - // public static final CreativeTabs MOREFOOD_FOOD = new Impl("morefood_food", Items.CHOCOLATE); + private Item tabIconItem; public CreativeTabs(String label, Item tabIconItem) { super(label); - this.setTabIconItem(tabIconItem); + this.tabIconItem = tabIconItem; } - public CreativeTabs(int index, String label, Item tabIconItem) + @Override + public Item getTabIconItem() { - super(index, label); - - this.setTabIconItem(tabIconItem); - } - - public abstract void setTabIconItem(Item tabIconItem); - - public static class Impl extends CreativeTabs - { - private Item tabIconItem; - - public Impl(String label, Item tabIconItem) - { - super(label, tabIconItem); - } - - public Impl(int index, String label, Item tabIconItem) - { - super(index, label, tabIconItem); - } - - @Override - public void setTabIconItem(Item tabIconItem) - { - this.tabIconItem = tabIconItem; - } - - @Override - public Item getTabIconItem() - { - return this.tabIconItem; - } + return tabIconItem; } } diff --git a/src/main/java/io/teammion/morefood/Items.java b/src/main/java/io/teammion/morefood/Items.java index a931462..d95e294 100644 --- a/src/main/java/io/teammion/morefood/Items.java +++ b/src/main/java/io/teammion/morefood/Items.java @@ -31,6 +31,7 @@ public class Items extends net.minecraft.init.Items public static final ItemFood STRAWBERRY_CHOCOLATE_COATED = new ItemFood("strawberry_chocolate_coated", 8); public static final Item FRENCH_FRIES_RAW = new Item("french_fries_raw"); public static final ItemFood FRENCH_FRIES = new ItemFood("french_fries", 6); + public static final Item BREAD_DOUGH = new Item("bread_dough"); static void register() { @@ -58,6 +59,7 @@ static void register() Registry.register(STRAWBERRY_CHOCOLATE_COATED); Registry.register(FRENCH_FRIES_RAW); Registry.register(FRENCH_FRIES); + Registry.register(BREAD_DOUGH); } static void render() @@ -86,5 +88,6 @@ static void render() Registry.render(STRAWBERRY_CHOCOLATE_COATED); Registry.render(FRENCH_FRIES_RAW); Registry.render(FRENCH_FRIES); + Registry.render(BREAD_DOUGH); } } diff --git a/src/main/java/io/teammion/morefood/MoreFood.java b/src/main/java/io/teammion/morefood/MoreFood.java index 38b5309..a95d763 100644 --- a/src/main/java/io/teammion/morefood/MoreFood.java +++ b/src/main/java/io/teammion/morefood/MoreFood.java @@ -3,6 +3,9 @@ import io.teammion.morefood.recipes.ShapedRecipes; import io.teammion.morefood.recipes.ShapelessRecipes; import io.teammion.morefood.recipes.SmeltingRecipes; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -10,6 +13,8 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.relauncher.Side; +import java.util.Iterator; + /** * Created by Stefan Wimmer on 05.06.16. */ @@ -19,6 +24,8 @@ public class MoreFood @Mod.EventHandler public void preInit(FMLPreInitializationEvent e) { + Config.load(e); + Items.register(); Blocks.register(); } @@ -42,5 +49,17 @@ public void init(FMLInitializationEvent e) @Mod.EventHandler public void postInit(FMLPostInitializationEvent e) { + if (Config.OVERRIDE_BREAD_RECIPE) + { + Iterator itr = CraftingManager.getInstance().getRecipeList().iterator(); + + while (itr.hasNext()) + { + ItemStack itemStack = itr.next().getRecipeOutput(); + + if (itemStack != null && itemStack.getItem() == Items.BREAD) + itr.remove(); + } + } } } diff --git a/src/main/java/io/teammion/morefood/recipes/ShapelessRecipes.java b/src/main/java/io/teammion/morefood/recipes/ShapelessRecipes.java index 7e4e35d..b3aeb5f 100644 --- a/src/main/java/io/teammion/morefood/recipes/ShapelessRecipes.java +++ b/src/main/java/io/teammion/morefood/recipes/ShapelessRecipes.java @@ -1,5 +1,6 @@ package io.teammion.morefood.recipes; +import io.teammion.morefood.Config; import io.teammion.morefood.Items; import io.teammion.morefood.Registry; import net.minecraft.item.ItemStack; @@ -79,5 +80,14 @@ public static void register() Items.POTATO, Items.POTATO ); + + Registry.addShapelessRecipe( + new ItemStack(Items.BREAD_DOUGH, 2), + Items.FLOUR, + Items.FLOUR, + Items.FLOUR, + Items.FLOUR, + Items.WATER_BUCKET + ); } } diff --git a/src/main/java/io/teammion/morefood/recipes/SmeltingRecipes.java b/src/main/java/io/teammion/morefood/recipes/SmeltingRecipes.java index db28c15..3b355d7 100644 --- a/src/main/java/io/teammion/morefood/recipes/SmeltingRecipes.java +++ b/src/main/java/io/teammion/morefood/recipes/SmeltingRecipes.java @@ -45,5 +45,10 @@ public static void register() Items.FRENCH_FRIES_RAW, new ItemStack(Items.FRENCH_FRIES) ); + + Registry.addSmelting( + Items.BREAD_DOUGH, + new ItemStack(Items.BREAD) + ); } } diff --git a/src/main/resources/assets/tm-morefood/lang/en_US.lang b/src/main/resources/assets/tm-morefood/lang/en_US.lang index df04d62..1b25933 100644 --- a/src/main/resources/assets/tm-morefood/lang/en_US.lang +++ b/src/main/resources/assets/tm-morefood/lang/en_US.lang @@ -25,3 +25,4 @@ item.strawberry_chocolate.name=Strawberry + Chocolate item.strawberry_chocolate_coated.name=Chocolate Coated Strawberry item.french_fries_raw.name=Raw French Fries item.french_fries.name=French Fries +item.bread_dough.name=Bread Dough diff --git a/src/main/resources/assets/tm-morefood/models/item/bread_dough.json b/src/main/resources/assets/tm-morefood/models/item/bread_dough.json new file mode 100644 index 0000000..11d1ae9 --- /dev/null +++ b/src/main/resources/assets/tm-morefood/models/item/bread_dough.json @@ -0,0 +1,6 @@ +{ + "parent": "tm-morefood:item/_default", + "textures": { + "layer0": "tm-morefood:items/bread_dough" + } +} diff --git a/src/main/resources/assets/tm-morefood/textures/items/bread_dough.png b/src/main/resources/assets/tm-morefood/textures/items/bread_dough.png new file mode 100644 index 0000000..e4f7100 Binary files /dev/null and b/src/main/resources/assets/tm-morefood/textures/items/bread_dough.png differ diff --git a/update.sh b/update.sh deleted file mode 100755 index fa20d11..0000000 --- a/update.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -# Get version -modid="$(node <<< "console.log(require(\"./package.json\").name);")" -version="$(node <<< "console.log(require(\"./package.json\").version);")" -echo "Version: $version" - -# Update build.gradle -echo "Updating build.gradle..." -while IFS="" read line -do - if [ "${line:0:10}" == "version = " ] - then - old_version="$line" - fi -done < build.gradle -sed -i "/$old_version/c\version = \"$version\"" build.gradle -sed -i "/group/c\group = \"io.teammion.morefood\"" build.gradle -sed -i "/archivesBaseName/c\archivesBaseName = \"$modid\"" build.gradle - -# Update mcmod.info -echo "Updating mcmod.info..." -sed -i "/modid/c\ \"modid\": \"$modid\"," src/main/resources/mcmod.info