Apple jam

This commit is contained in:
Emmanuel BENOîT 2016-07-22 09:45:18 +02:00
parent 3b195cac66
commit 15e914f706
13 changed files with 141 additions and 96 deletions

BIN
graphics/jars.xcf Normal file

Binary file not shown.

View file

@ -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( );
}

View file

@ -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;
}
}

View file

@ -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 );

View file

@ -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 );
}
}

View file

@ -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 );
}
}

View file

@ -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;
}
}

View file

@ -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( );
}

View file

@ -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

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "mmm:items/food/ingredient/glass_jar"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "mmm:items/food/jam/apple"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B