From 15e914f7069cfb52b8c755dc4bf712a4d73aac1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 22 Jul 2016 09:45:18 +0200 Subject: [PATCH] Apple jam --- graphics/jars.xcf | Bin 0 -> 2645 bytes src/java/mmm/MmmFood.java | 3 + src/java/mmm/food/FFoodInContainer.java | 74 ++++++++++++++ src/java/mmm/food/FGlowingSoup.java | 4 +- src/java/mmm/food/FIngredients.java | 14 +++ src/java/mmm/food/FJams.java | 29 ++++++ src/java/mmm/food/FMealInBowl.java | 91 ------------------ src/java/mmm/food/FSoups.java | 7 +- src/resources/assets/mmm/lang/en_US.lang | 3 + .../item/food/ingredient/glass_jar.json | 6 ++ .../mmm/models/item/food/jam/apple.json | 6 ++ .../items/food/ingredient/glass_jar.png | Bin 0 -> 181 bytes .../mmm/textures/items/food/jam/apple.png | Bin 0 -> 227 bytes 13 files changed, 141 insertions(+), 96 deletions(-) create mode 100644 graphics/jars.xcf create mode 100644 src/java/mmm/food/FFoodInContainer.java create mode 100644 src/java/mmm/food/FJams.java delete mode 100644 src/java/mmm/food/FMealInBowl.java create mode 100644 src/resources/assets/mmm/models/item/food/ingredient/glass_jar.json create mode 100644 src/resources/assets/mmm/models/item/food/jam/apple.json create mode 100644 src/resources/assets/mmm/textures/items/food/ingredient/glass_jar.png create mode 100644 src/resources/assets/mmm/textures/items/food/jam/apple.png diff --git a/graphics/jars.xcf b/graphics/jars.xcf new file mode 100644 index 0000000000000000000000000000000000000000..53d4ff644700a5620762653776266ab697f387db GIT binary patch literal 2645 zcmeHJO=uHA6n?v#|0-6k9>l}?15FQ+O7zf+kld^n5qc<|k~CRYl59vKCI^X^9)(Dy zDnvohv<=8IMVsG*Eub8&r?W9oMV`yWF+s$tlWo{4G6ke1iy z&;`VIgN0%_om2}(TA!N;1XEhVNE>-IXsJ+Mi^tT-Gn1AK0B1QhfkWd1h6-NY8PL#D zAs0*NSxr4B;st``0Y2^u-N@=iRnI1_B?~m#NTmwN;;;13Rql5&k8>#P0vG8nfIJVN zyaMpN1@K=G3~EsV+A-gBEUy-g9MK+ZwCnG&`8cLNevVPWaT^ZU@Q4lXv*G#A3GdMNXb^`ef@&odkcY0v}+2Hp!3Dw`M#bxo$aqt~+F(fNl$`+--u~hZ^YXw4jBn>-OQM%}>|` zod!@Z4CUDc#yK0HK&ROtB{jU@ZjAj;hwtEyyJJ$ZOxorFsAGaj#UlQ<7>h++tteQm zKVoZ6tP)-Y$;3*T^foyzLLidM;aBE*EJKV;KPba+E$Hdx;=Rp*?OJ&6Iep%zWM6?F z-#0hg>+2isjW(X`zp&QUR#(4%VNu?EW-&jl^u+YQPsYG0n)~JQa;;ijtS#24-`=gI zM+*xN9Bv!&qN~O@$pbN6sCTAw=PGgrlOZvl=)c}bNXgaOq`oB z*4*1qt$1?nn$F#6DvqcgJ-{RMv5p(XqG27pVK{J<0~h}{4n)fM4hO`yjr#)l4-TLL X&%j;xf`nf$sUF>(jaQLf$tY|Ab}KVc literal 0 HcmV?d00001 diff --git a/src/java/mmm/MmmFood.java b/src/java/mmm/MmmFood.java index cb4e216..a1e135e 100644 --- a/src/java/mmm/MmmFood.java +++ b/src/java/mmm/MmmFood.java @@ -2,6 +2,7 @@ package mmm; import mmm.food.FIngredients; +import mmm.food.FJams; import mmm.food.FMeals; import mmm.food.FMilks; import mmm.food.FPies; @@ -16,6 +17,7 @@ public class MmmFood public static final FMeals MEAL; public static final FPies PIE; public static final FSoups SOUP; + public static final FJams JAM; static { MILK = new FMilks( ); @@ -23,6 +25,7 @@ public class MmmFood MEAL = new FMeals( ); PIE = new FPies( ); SOUP = new FSoups( ); + JAM = new FJams( ); } diff --git a/src/java/mmm/food/FFoodInContainer.java b/src/java/mmm/food/FFoodInContainer.java new file mode 100644 index 0000000..f2a1ef4 --- /dev/null +++ b/src/java/mmm/food/FFoodInContainer.java @@ -0,0 +1,74 @@ +package mmm.food; + + +import javax.annotation.Nullable; + +import mmm.core.CRegistry; +import mmm.core.api.I_RecipeRegistrar; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.registry.GameRegistry; + + + +public class FFoodInContainer + extends ItemFood + implements I_RecipeRegistrar +{ + + private Object[] recipe; + + + public FFoodInContainer( final String section , final String name , final int amount , final float saturation , + final Item container , final int maxStackSize , final Object... recipe ) + { + super( amount , saturation , false ); + this.setMaxStackSize( maxStackSize ); + this.setContainerItem( container ); + + 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 ] = container; + } else { + this.recipe = new Object[ recipe.length + 1 ]; + System.arraycopy( recipe , 0 , this.recipe , 0 , recipe.length ); + this.recipe[ recipe.length ] = container; + } + + CRegistry.setIdentifiers( this , "food" , section , name ); + CRegistry.addItem( this ); + } + + + @Override + @Nullable + public ItemStack onItemUseFinish( final ItemStack stack , final World worldIn , + final EntityLivingBase entityLiving ) + { + super.onItemUseFinish( stack , worldIn , entityLiving ); + return new ItemStack( this.getContainerItem( ) ); + } + + + @Override + public void registerRecipes( ) + { + if ( this.recipe == null ) { + return; + } + if ( this.recipe[ 0 ] instanceof String ) { + GameRegistry.addShapedRecipe( new ItemStack( this ) , this.recipe ); + } else { + GameRegistry.addShapelessRecipe( new ItemStack( this ) , this.recipe ); + } + this.recipe = null; + } + +} diff --git a/src/java/mmm/food/FGlowingSoup.java b/src/java/mmm/food/FGlowingSoup.java index d5423e1..b547c6e 100644 --- a/src/java/mmm/food/FGlowingSoup.java +++ b/src/java/mmm/food/FGlowingSoup.java @@ -13,12 +13,12 @@ import net.minecraftforge.oredict.OreDictionary; public class FGlowingSoup - extends FMealInBowl + extends FFoodInContainer { public FGlowingSoup( ) { - super( "soup" , "glowing" , 4 , 0.6f , // + super( "soup" , "glowing" , 4 , 0.6f , Items.BOWL , 1 , // "CCC" , "CPC" , " B " , // 'C' , new ItemStack( MmmPlants.NETHER_CORAL.ITEM , 1 , OreDictionary.WILDCARD_VALUE ) , // 'P' , Items.POTATO ); diff --git a/src/java/mmm/food/FIngredients.java b/src/java/mmm/food/FIngredients.java index a237ab6..791fd24 100644 --- a/src/java/mmm/food/FIngredients.java +++ b/src/java/mmm/food/FIngredients.java @@ -4,6 +4,7 @@ package mmm.food; import mmm.MmmMaterials; import mmm.core.CRegistry; import mmm.core.api.I_RecipeRegistrar; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -16,6 +17,7 @@ public class FIngredients { public final Item FLOUR; public final Item DOUGH; + public final Item GLASS_JAR; public FIngredients( ) @@ -24,6 +26,7 @@ public class FIngredients this.FLOUR = FHelpers.makeIngredient( "flour" ); this.DOUGH = FHelpers.makeIngredient( "dough" ); + this.GLASS_JAR = FHelpers.makeIngredient( "glass_jar" ); } @@ -43,6 +46,17 @@ public class FIngredients GameRegistry.addShapelessRecipe( new ItemStack( this.DOUGH ) , // this.FLOUR , Items.WATER_BUCKET , MmmMaterials.ITEM.ROCK_SALT ); + + GameRegistry.addShapedRecipe( new ItemStack( GLASS_JAR , 16 ) , // + "G G" , // + "G G" , // + "GGG" , // + 'G' , Blocks.GLASS ); + GameRegistry.addShapedRecipe( new ItemStack( GLASS_JAR , 16 ) , // + "G G" , // + "G G" , // + "GGG" , // + 'G' , Blocks.STAINED_GLASS ); } } diff --git a/src/java/mmm/food/FJams.java b/src/java/mmm/food/FJams.java new file mode 100644 index 0000000..8c977c6 --- /dev/null +++ b/src/java/mmm/food/FJams.java @@ -0,0 +1,29 @@ +package mmm.food; + + +import mmm.MmmFood; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; + + + +public class FJams +{ + + public final ItemFood APPLE; + + + public FJams( ) + { + this.APPLE = FJams.makeJam( "apple" , Items.APPLE ); + } + + + public static FFoodInContainer makeJam( final String name , final Item fruit ) + { + return new FFoodInContainer( "jam" , name , 5 , 0.9f , MmmFood.INGREDIENT.GLASS_JAR , 16 , // + fruit , Items.SUGAR , Items.SUGAR ); + } + +} diff --git a/src/java/mmm/food/FMealInBowl.java b/src/java/mmm/food/FMealInBowl.java deleted file mode 100644 index a7f6a9f..0000000 --- a/src/java/mmm/food/FMealInBowl.java +++ /dev/null @@ -1,91 +0,0 @@ -package mmm.food; - - -import javax.annotation.Nullable; - -import mmm.core.CRegistry; -import mmm.core.api.I_RecipeRegistrar; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.Items; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.registry.GameRegistry; - - - -public class FMealInBowl - extends ItemFood - implements I_RecipeRegistrar -{ - - private 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 ); - - 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; - } 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; - } - } - - - @Nullable - public ItemStack onItemUseFinish( ItemStack stack , World worldIn , EntityLivingBase entityLiving ) - { - super.onItemUseFinish( stack , worldIn , entityLiving ); - return new ItemStack( Items.BOWL ); - } - - - @Override - public void registerRecipes( ) - { - if ( this.recipe == null ) { - return; - } - if ( this.recipe[ 0 ] instanceof String ) { - GameRegistry.addShapedRecipe( new ItemStack( this ) , recipe ); - } else { - GameRegistry.addShapelessRecipe( new ItemStack( this ) , recipe ); - } - this.recipe = null; - } - -} diff --git a/src/java/mmm/food/FSoups.java b/src/java/mmm/food/FSoups.java index 7e33ee9..e31f88c 100644 --- a/src/java/mmm/food/FSoups.java +++ b/src/java/mmm/food/FSoups.java @@ -2,18 +2,19 @@ package mmm.food; import mmm.MmmPlants; +import net.minecraft.init.Items; public class FSoups { - public final FMealInBowl TOMATO; - public final FMealInBowl GLOWING; + public final FFoodInContainer TOMATO; + public final FFoodInContainer GLOWING; public FSoups( ) { - this.TOMATO = new FMealInBowl( "soup" , "tomato" , 8 , 1.1f , // + this.TOMATO = new FFoodInContainer( "soup" , "tomato" , 8 , 1.1f , Items.BOWL , 1 , // "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 35e64e2..192ceb0 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -156,6 +156,7 @@ item.mmm.food.milk.donkey.name=Donkey milk item.mmm.food.ingredient.flour.name=Wheat Flour item.mmm.food.ingredient.dough.name=Dough +item.mmm.food.ingredient.glass_jar.name=Empty Glass Jar item.mmm.food.meal.sausage.raw.name=Raw Sausage item.mmm.food.meal.sausage.cooked.name=Sausage @@ -169,6 +170,8 @@ item.mmm.food.soup.glowing.name=Glowing Soup item.mmm.food.pie.apple.name=Apple Pie +item.mmm.food.jam.apple.name=Apple Jam + tile.mmm.deco.smoothstone.limestone.name=Polished Limestone tile.mmm.deco.smoothstone.basalt.name=Polished Basalt diff --git a/src/resources/assets/mmm/models/item/food/ingredient/glass_jar.json b/src/resources/assets/mmm/models/item/food/ingredient/glass_jar.json new file mode 100644 index 0000000..5383abe --- /dev/null +++ b/src/resources/assets/mmm/models/item/food/ingredient/glass_jar.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "mmm:items/food/ingredient/glass_jar" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/food/jam/apple.json b/src/resources/assets/mmm/models/item/food/jam/apple.json new file mode 100644 index 0000000..09d8323 --- /dev/null +++ b/src/resources/assets/mmm/models/item/food/jam/apple.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "mmm:items/food/jam/apple" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/items/food/ingredient/glass_jar.png b/src/resources/assets/mmm/textures/items/food/ingredient/glass_jar.png new file mode 100644 index 0000000000000000000000000000000000000000..f37f283e5639c7c6ca6a98d788ba4cd1d8b062c5 GIT binary patch literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`HJ&bxAr_~T6BelLsNM6(p67l1 z^vZ+;$7o{n&-znMQYxDGPJNOe|M*T4V%Dgra3_3YV7W^hh_~D z%^ArIXW~sv8I}pIXFPJl=R!m3>1ltDw{c1_1b3WgJ;65d4eOpp4r7+(Dj~{tl{~F4 eW;BX1FwD>Rz2+!$)Hk3z7(8A5T-G@yGywoLFh(2z literal 0 HcmV?d00001 diff --git a/src/resources/assets/mmm/textures/items/food/jam/apple.png b/src/resources/assets/mmm/textures/items/food/jam/apple.png new file mode 100644 index 0000000000000000000000000000000000000000..6a0adeea4bfeca2c02d0e5d454eac7fa5d7a7390 GIT binary patch literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`t2|vCLo7}wCoE9gQM>1nJ77l}ef!&z*UXx4Q~Bxt#k