Cookable meals and textureless sausage!
This commit is contained in:
parent
443b532645
commit
32185b7e73
4 changed files with 87 additions and 0 deletions
|
@ -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( );
|
||||
}
|
||||
|
||||
|
||||
|
|
60
src/java/mmm/food/FCookableMeal.java
Normal file
60
src/java/mmm/food/FCookableMeal.java
Normal file
|
@ -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 );
|
||||
}
|
||||
|
||||
}
|
21
src/java/mmm/food/FMeals.java
Normal file
21
src/java/mmm/food/FMeals.java
Normal file
|
@ -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 );
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
Reference in a new issue