Skip to content

Commit

Permalink
Add bread dough, Release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Wimmer committed Jul 23, 2016
1 parent 42d9c87 commit 7d23aed
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 94 deletions.
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ buildscript {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}

apply plugin: 'net.minecraftforge.gradle.forge'

/*
Expand All @@ -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.
Expand All @@ -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
Expand Down
8 changes: 0 additions & 8 deletions build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
},
Expand Down
16 changes: 0 additions & 16 deletions setup.sh

This file was deleted.

25 changes: 25 additions & 0 deletions src/main/java/io/teammion/morefood/Config.java
Original file line number Diff line number Diff line change
@@ -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 <[email protected]> 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();
}
}
45 changes: 7 additions & 38 deletions src/main/java/io/teammion/morefood/CreativeTabs.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,22 @@
import net.minecraft.item.Item;

/**
* Created by Stefan Wimmer <[email protected]> on 05.06.16.
* Created by Stefan Wimmer <[email protected]> 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;
}
}
3 changes: 3 additions & 0 deletions src/main/java/io/teammion/morefood/Items.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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);
}
}
19 changes: 19 additions & 0 deletions src/main/java/io/teammion/morefood/MoreFood.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
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;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.Side;

import java.util.Iterator;

/**
* Created by Stefan Wimmer <[email protected]> on 05.06.16.
*/
Expand All @@ -19,6 +24,8 @@ public class MoreFood
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e)
{
Config.load(e);

Items.register();
Blocks.register();
}
Expand All @@ -42,5 +49,17 @@ public void init(FMLInitializationEvent e)
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent e)
{
if (Config.OVERRIDE_BREAD_RECIPE)
{
Iterator<IRecipe> itr = CraftingManager.getInstance().getRecipeList().iterator();

while (itr.hasNext())
{
ItemStack itemStack = itr.next().getRecipeOutput();

if (itemStack != null && itemStack.getItem() == Items.BREAD)
itr.remove();
}
}
}
}
10 changes: 10 additions & 0 deletions src/main/java/io/teammion/morefood/recipes/ShapelessRecipes.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/tm-morefood/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "tm-morefood:item/_default",
"textures": {
"layer0": "tm-morefood:items/bread_dough"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 0 additions & 23 deletions update.sh

This file was deleted.

0 comments on commit 7d23aed

Please sign in to comment.