diff --git a/src/java/mmm/MmmFood.java b/src/java/mmm/MmmFood.java index 60675b3..356d5e2 100644 --- a/src/java/mmm/MmmFood.java +++ b/src/java/mmm/MmmFood.java @@ -1,6 +1,7 @@ package mmm; +import mmm.food.FMeals; import mmm.food.FMilks; @@ -8,9 +9,11 @@ import mmm.food.FMilks; public class MmmFood { public static final FMilks MILK; + public static final FMeals MEAL; static { MILK = new FMilks( ); + MEAL = new FMeals( ); } diff --git a/src/java/mmm/food/FCookableMeal.java b/src/java/mmm/food/FCookableMeal.java new file mode 100644 index 0000000..f5e9b42 --- /dev/null +++ b/src/java/mmm/food/FCookableMeal.java @@ -0,0 +1,60 @@ +package mmm.food; + + +import mmm.core.CRegistry; +import mmm.core.api.I_RecipeRegistrar; +import net.minecraft.init.MobEffects; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; +import net.minecraftforge.fml.common.registry.GameRegistry; + + + +public class FCookableMeal + implements I_RecipeRegistrar +{ + + public final ItemFood RAW; + public final ItemFood COOKED; + + private final int quantity; + private Object[] recipe; + + + public FCookableMeal( final String name , final int amount , final float saturation , final boolean dangerous , + final boolean wolfLikes , final int quantity , final Object... recipe ) + { + this.RAW = new ItemFood( Math.max( 1 , amount / 3 ) , saturation / 3f , wolfLikes ); + if ( dangerous ) { + this.RAW.setPotionEffect( new PotionEffect( MobEffects.HUNGER , 600 , 0 ) , .3f ); + } + CRegistry.setIdentifiers( this.RAW , "food" , "meals" , name , "raw" ); + CRegistry.addItem( this.RAW ); + + this.COOKED = new ItemFood( amount , saturation , wolfLikes ); + CRegistry.setIdentifiers( this.COOKED , "food" , "meals" , name , "cooked" ); + CRegistry.addItem( this.COOKED ); + + this.quantity = quantity; + this.recipe = recipe.clone( ); + CRegistry.addRecipeRegistrar( this ); + } + + + @Override + public void registerRecipes( ) + { + if ( this.quantity > 0 && this.recipe.length > 0 ) { + if ( this.recipe[ 0 ] instanceof String ) { + GameRegistry.addShapedRecipe( new ItemStack( this.RAW , this.quantity ) , this.recipe ); + } else { + GameRegistry.addShapelessRecipe( new ItemStack( this.RAW , this.quantity ) , this.recipe ); + } + this.recipe = null; + } + + GameRegistry.addSmelting( this.RAW , new ItemStack( this.COOKED ) , 0.35f ); + } + +} diff --git a/src/java/mmm/food/FMeals.java b/src/java/mmm/food/FMeals.java new file mode 100644 index 0000000..e6e1d57 --- /dev/null +++ b/src/java/mmm/food/FMeals.java @@ -0,0 +1,21 @@ +package mmm.food; + + +import mmm.MmmMaterials; +import net.minecraft.init.Items; + + + +public class FMeals +{ + + public final FCookableMeal SAUSAGE; + + + public FMeals( ) + { + this.SAUSAGE = new FCookableMeal( "sausage" , 3 , 0.7f , true , true , 4 , // + Items.PORKCHOP , MmmMaterials.ITEM.ROCK_SALT , Items.LEATHER ); + } + +} diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index 010e5f2..29f6a51 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -135,6 +135,9 @@ item.mmm.food.milk.pig.name=Pig milk item.mmm.food.milk.horse.name=Horse milk item.mmm.food.milk.donkey.name=Donkey milk +item.mmm.food.meals.sausage.raw.name=Raw Sausage +item.mmm.food.meals.sausage.cooked.name=Sausage + tile.mmm.deco.smoothstone.limestone.name=Polished Limestone tile.mmm.deco.smoothstone.basalt.name=Polished Basalt