From 3b195cac6665a4cc70a7f6330deac11050555b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 22 Jul 2016 08:38:23 +0200 Subject: [PATCH] Reorganised food --- src/java/mmm/MmmFood.java | 6 ++++ src/java/mmm/food/FGlowingSoup.java | 2 +- src/java/mmm/food/FHelpers.java | 5 ++- src/java/mmm/food/FMealInBowl.java | 26 ++++++++++++-- src/java/mmm/food/FMeals.java | 28 --------------- src/java/mmm/food/FPies.java | 34 ++++++++++++++++++ src/java/mmm/food/FSausage.java | 2 +- src/java/mmm/food/FSoups.java | 20 +++++++++++ src/resources/assets/mmm/lang/en_US.lang | 6 ++-- .../item/food/{meal => }/pie/apple.json | 2 +- .../tomato_soup.json => soup/glowing.json} | 2 +- .../glowing_soup.json => soup/tomato.json} | 2 +- .../items/food/{meal => }/pie/apple.png | Bin .../glowing_soup.png => soup/glowing.png} | Bin .../{meal/tomato_soup.png => soup/tomato.png} | Bin 15 files changed, 94 insertions(+), 41 deletions(-) create mode 100644 src/java/mmm/food/FPies.java create mode 100644 src/java/mmm/food/FSoups.java rename src/resources/assets/mmm/models/item/food/{meal => }/pie/apple.json (57%) rename src/resources/assets/mmm/models/item/food/{meal/tomato_soup.json => soup/glowing.json} (56%) rename src/resources/assets/mmm/models/item/food/{meal/glowing_soup.json => soup/tomato.json} (55%) rename src/resources/assets/mmm/textures/items/food/{meal => }/pie/apple.png (100%) rename src/resources/assets/mmm/textures/items/food/{meal/glowing_soup.png => soup/glowing.png} (100%) rename src/resources/assets/mmm/textures/items/food/{meal/tomato_soup.png => soup/tomato.png} (100%) diff --git a/src/java/mmm/MmmFood.java b/src/java/mmm/MmmFood.java index e072eae..cb4e216 100644 --- a/src/java/mmm/MmmFood.java +++ b/src/java/mmm/MmmFood.java @@ -4,6 +4,8 @@ package mmm; import mmm.food.FIngredients; import mmm.food.FMeals; import mmm.food.FMilks; +import mmm.food.FPies; +import mmm.food.FSoups; @@ -12,11 +14,15 @@ public class MmmFood public static final FMilks MILK; public static final FIngredients INGREDIENT; public static final FMeals MEAL; + public static final FPies PIE; + public static final FSoups SOUP; static { MILK = new FMilks( ); INGREDIENT = new FIngredients( ); MEAL = new FMeals( ); + PIE = new FPies( ); + SOUP = new FSoups( ); } diff --git a/src/java/mmm/food/FGlowingSoup.java b/src/java/mmm/food/FGlowingSoup.java index 162ea02..d5423e1 100644 --- a/src/java/mmm/food/FGlowingSoup.java +++ b/src/java/mmm/food/FGlowingSoup.java @@ -18,7 +18,7 @@ public class FGlowingSoup public FGlowingSoup( ) { - super( "glowing_soup" , 4 , 0.6f , // + super( "soup" , "glowing" , 4 , 0.6f , // "CCC" , "CPC" , " B " , // 'C' , new ItemStack( MmmPlants.NETHER_CORAL.ITEM , 1 , OreDictionary.WILDCARD_VALUE ) , // 'P' , Items.POTATO ); diff --git a/src/java/mmm/food/FHelpers.java b/src/java/mmm/food/FHelpers.java index b83f678..e5e3cc1 100644 --- a/src/java/mmm/food/FHelpers.java +++ b/src/java/mmm/food/FHelpers.java @@ -18,10 +18,9 @@ public class FHelpers final ItemFood item = new ItemFood( amount , saturation , wolfFood ); item.setCreativeTab( CreativeTabs.FOOD ); - String[] fullName = new String[ name.length + 2 ]; + String[] fullName = new String[ name.length + 1 ]; fullName[ 0 ] = "food"; - fullName[ 1 ] = "meal"; - System.arraycopy( name , 0 , fullName , 2 , name.length ); + System.arraycopy( name , 0 , fullName , 1 , name.length ); CRegistry.setIdentifiers( item , fullName ); CRegistry.addItem( item ); diff --git a/src/java/mmm/food/FMealInBowl.java b/src/java/mmm/food/FMealInBowl.java index 5d33a4d..a7f6a9f 100644 --- a/src/java/mmm/food/FMealInBowl.java +++ b/src/java/mmm/food/FMealInBowl.java @@ -22,12 +22,34 @@ public class FMealInBowl private Object[] recipe; - public FMealInBowl( final String name , final int amount , final float saturation , Object... recipe ) + public FMealInBowl( final String section , final String name , final int amount , final float saturation , + Object... recipe ) { super( amount , saturation , false ); this.setMaxStackSize( 1 ); - CRegistry.setIdentifiers( this , "food" , "meal" , name ); + + if ( recipe.length == 0 ) { + this.recipe = null; + } else if ( recipe[ 0 ] instanceof String ) { + this.recipe = new Object[ recipe.length + 2 ]; + System.arraycopy( recipe , 0 , this.recipe , 0 , recipe.length ); + this.recipe[ recipe.length ] = 'B'; + this.recipe[ recipe.length + 1 ] = Items.BOWL; + } else { + this.recipe = new Object[ recipe.length + 1 ]; + System.arraycopy( recipe , 0 , this.recipe , 0 , recipe.length ); + this.recipe[ recipe.length ] = Items.BOWL; + } + + CRegistry.setIdentifiers( this , "food" , section , name ); CRegistry.addItem( this ); + } + + + public FMealInBowl( int amount , float saturation , Object[] recipe ) + { + super( amount , saturation , false ); + this.setMaxStackSize( 1 ); if ( recipe.length == 0 ) { this.recipe = null; diff --git a/src/java/mmm/food/FMeals.java b/src/java/mmm/food/FMeals.java index 3b6dde9..6fa7d4e 100644 --- a/src/java/mmm/food/FMeals.java +++ b/src/java/mmm/food/FMeals.java @@ -2,50 +2,22 @@ package mmm.food; import mmm.MmmFood; -import mmm.MmmPlants; -import mmm.core.CRegistry; -import mmm.core.api.I_RecipeRegistrar; import net.minecraft.init.Items; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.registry.GameRegistry; public class FMeals - implements I_RecipeRegistrar { public final FSausage SAUSAGE; public final FCookableMeal PASTA; - public final FMealInBowl TOMATO_SOUP; - public final FMealInBowl GLOWING_SOUP; - - public final ItemFood APPLE_PIE; - public FMeals( ) { - CRegistry.addRegistrar( this ); - this.SAUSAGE = new FSausage( ); this.PASTA = new FCookableMeal( "pasta" , 2 , 0.7f , 0.5f , false , 1 , // Items.EGG , MmmFood.INGREDIENT.FLOUR ); - - this.TOMATO_SOUP = new FMealInBowl( "tomato_soup" , 8 , 1.1f , // - "TTT" , " B " , 'T' , MmmPlants.TOMATO.FRUIT ); - this.GLOWING_SOUP = new FGlowingSoup( ); - - this.APPLE_PIE = FHelpers.makeBasicMeal( 8 , 0.5f , false , "pie" , "apple" ); - } - - - @Override - public void registerRecipes( ) - { - GameRegistry.addShapelessRecipe( new ItemStack( this.APPLE_PIE ) , // - MmmFood.INGREDIENT.DOUGH , Items.SUGAR , Items.APPLE ); } } diff --git a/src/java/mmm/food/FPies.java b/src/java/mmm/food/FPies.java new file mode 100644 index 0000000..b13af98 --- /dev/null +++ b/src/java/mmm/food/FPies.java @@ -0,0 +1,34 @@ +package mmm.food; + + +import mmm.MmmFood; +import mmm.core.CRegistry; +import mmm.core.api.I_RecipeRegistrar; +import net.minecraft.init.Items; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.registry.GameRegistry; + + + +public class FPies + implements I_RecipeRegistrar +{ + public final ItemFood APPLE; + + + public FPies( ) + { + this.APPLE = FHelpers.makeBasicMeal( 8 , 0.5f , false , "pie" , "apple" ); + } + + + @Override + public void registerRecipes( ) + { + CRegistry.addRegistrar( this ); + + GameRegistry.addShapelessRecipe( new ItemStack( this.APPLE ) , // + MmmFood.INGREDIENT.DOUGH , Items.SUGAR , Items.APPLE ); + } +} diff --git a/src/java/mmm/food/FSausage.java b/src/java/mmm/food/FSausage.java index 6f944e5..6b0ee43 100644 --- a/src/java/mmm/food/FSausage.java +++ b/src/java/mmm/food/FSausage.java @@ -19,7 +19,7 @@ public class FSausage { super( "sausage" , 3 , 0.7f , 1.3f , true , 4 , // Items.PORKCHOP , MmmMaterials.ITEM.ROCK_SALT , Items.LEATHER ); - this.DRIED = FHelpers.makeBasicMeal( 4 , 0.9f , true , "sausage" , "dried" ); + this.DRIED = FHelpers.makeBasicMeal( 4 , 0.9f , true , "meal" , "sausage" , "dried" ); } diff --git a/src/java/mmm/food/FSoups.java b/src/java/mmm/food/FSoups.java new file mode 100644 index 0000000..7e33ee9 --- /dev/null +++ b/src/java/mmm/food/FSoups.java @@ -0,0 +1,20 @@ +package mmm.food; + + +import mmm.MmmPlants; + + + +public class FSoups +{ + public final FMealInBowl TOMATO; + public final FMealInBowl GLOWING; + + + public FSoups( ) + { + this.TOMATO = new FMealInBowl( "soup" , "tomato" , 8 , 1.1f , // + "TTT" , " B " , 'T' , MmmPlants.TOMATO.FRUIT ); + this.GLOWING = new FGlowingSoup( ); + } +} diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index 4a051dd..35e64e2 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -164,10 +164,10 @@ item.mmm.food.meal.sausage.dried.name=Dried Sausage item.mmm.food.meal.pasta.raw.name=Pasta Dough item.mmm.food.meal.pasta.cooked.name=Pasta -item.mmm.food.meal.tomato_soup.name=Tomato Soup -item.mmm.food.meal.glowing_soup.name=Glowing Soup +item.mmm.food.soup.tomato.name=Tomato Soup +item.mmm.food.soup.glowing.name=Glowing Soup -item.mmm.food.meal.pie.apple.name=Apple Pie +item.mmm.food.pie.apple.name=Apple Pie tile.mmm.deco.smoothstone.limestone.name=Polished Limestone diff --git a/src/resources/assets/mmm/models/item/food/meal/pie/apple.json b/src/resources/assets/mmm/models/item/food/pie/apple.json similarity index 57% rename from src/resources/assets/mmm/models/item/food/meal/pie/apple.json rename to src/resources/assets/mmm/models/item/food/pie/apple.json index b29bdf1..ceb241e 100644 --- a/src/resources/assets/mmm/models/item/food/meal/pie/apple.json +++ b/src/resources/assets/mmm/models/item/food/pie/apple.json @@ -1,6 +1,6 @@ { "parent": "minecraft:item/generated", "textures": { - "layer0": "mmm:items/food/meal/pie/apple" + "layer0": "mmm:items/food/pie/apple" } } \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/food/meal/tomato_soup.json b/src/resources/assets/mmm/models/item/food/soup/glowing.json similarity index 56% rename from src/resources/assets/mmm/models/item/food/meal/tomato_soup.json rename to src/resources/assets/mmm/models/item/food/soup/glowing.json index 685c671..fedf2e3 100644 --- a/src/resources/assets/mmm/models/item/food/meal/tomato_soup.json +++ b/src/resources/assets/mmm/models/item/food/soup/glowing.json @@ -1,6 +1,6 @@ { "parent": "minecraft:item/generated", "textures": { - "layer0": "mmm:items/food/meal/tomato_soup" + "layer0": "mmm:items/food/soup/glowing" } } \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/food/meal/glowing_soup.json b/src/resources/assets/mmm/models/item/food/soup/tomato.json similarity index 55% rename from src/resources/assets/mmm/models/item/food/meal/glowing_soup.json rename to src/resources/assets/mmm/models/item/food/soup/tomato.json index 8481f49..445b6ef 100644 --- a/src/resources/assets/mmm/models/item/food/meal/glowing_soup.json +++ b/src/resources/assets/mmm/models/item/food/soup/tomato.json @@ -1,6 +1,6 @@ { "parent": "minecraft:item/generated", "textures": { - "layer0": "mmm:items/food/meal/glowing_soup" + "layer0": "mmm:items/food/soup/tomato" } } \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/items/food/meal/pie/apple.png b/src/resources/assets/mmm/textures/items/food/pie/apple.png similarity index 100% rename from src/resources/assets/mmm/textures/items/food/meal/pie/apple.png rename to src/resources/assets/mmm/textures/items/food/pie/apple.png diff --git a/src/resources/assets/mmm/textures/items/food/meal/glowing_soup.png b/src/resources/assets/mmm/textures/items/food/soup/glowing.png similarity index 100% rename from src/resources/assets/mmm/textures/items/food/meal/glowing_soup.png rename to src/resources/assets/mmm/textures/items/food/soup/glowing.png diff --git a/src/resources/assets/mmm/textures/items/food/meal/tomato_soup.png b/src/resources/assets/mmm/textures/items/food/soup/tomato.png similarity index 100% rename from src/resources/assets/mmm/textures/items/food/meal/tomato_soup.png rename to src/resources/assets/mmm/textures/items/food/soup/tomato.png