Added biomass and biocoal made from canola seeds and also made canola seeds edible

Closes #130
This commit is contained in:
Ellpeck 2016-06-27 19:25:46 +02:00
parent 28c6e551d8
commit ee9c94da74
15 changed files with 122 additions and 24 deletions

View file

@ -35,8 +35,8 @@ public class BlockPlant extends BlockCrops{
private final int minDropAmount; private final int minDropAmount;
private final int addDropAmount; private final int addDropAmount;
public Item seedItem; public Item seedItem;
public Item returnItem; private Item returnItem;
public int returnMeta; private int returnMeta;
public BlockPlant(String name, int minDropAmount, int addDropAmount){ public BlockPlant(String name, int minDropAmount, int addDropAmount){
this.name = name; this.name = name;
@ -45,6 +45,12 @@ public class BlockPlant extends BlockCrops{
this.register(); this.register();
} }
public void doStuff(Item seedItem, Item returnItem, int returnMeta){
this.seedItem = seedItem;
this.returnItem = returnItem;
this.returnMeta = returnMeta;
}
private void register(){ private void register(){
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative()); ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
@ -71,7 +77,6 @@ public class BlockPlant extends BlockCrops{
return EnumRarity.RARE; return EnumRarity.RARE;
} }
@Override @Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){ public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
return EnumPlantType.Crop; return EnumPlantType.Crop;
@ -110,7 +115,6 @@ public class BlockPlant extends BlockCrops{
return false; return false;
} }
@Override @Override
public Item getSeed(){ public Item getSeed(){
return this.seedItem; return this.seedItem;
@ -121,13 +125,11 @@ public class BlockPlant extends BlockCrops{
return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount)+this.minDropAmount : super.quantityDropped(state, fortune, random); return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount)+this.minDropAmount : super.quantityDropped(state, fortune, random);
} }
@Override @Override
public Item getCrop(){ public Item getCrop(){
return this.returnItem; return this.returnItem;
} }
@Override @Override
public Item getItemDropped(IBlockState state, Random rand, int par3){ public Item getItemDropped(IBlockState state, Random rand, int par3){
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed(); return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();

View file

@ -29,6 +29,7 @@ public final class InitCrafting{
ToolCrafting.init(); ToolCrafting.init();
ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemMisc, 10, TheMiscItems.MASHED_FOOD.ordinal()), Blocks.LEAVES, new ItemStack(InitItems.itemFertilizer, 10), Blocks.DIRT); ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemMisc, 10, TheMiscItems.MASHED_FOOD.ordinal()), Blocks.LEAVES, new ItemStack(InitItems.itemFertilizer, 10), Blocks.DIRT);
ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemCanolaSeed, 20), Blocks.DIRT, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()), Blocks.SOUL_SAND);
} }
} }

View file

@ -31,6 +31,10 @@ public final class MiscCrafting{
public static void init(){ public static void init(){
//Bio Coal
GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOCOAL.ordinal()), 1.0F);
//Crystals //Crystals
for(int i = 0; i < TheCrystals.values().length; i++){ for(int i = 0; i < TheCrystals.values().length; i++){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCrystal, 1, i), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCrystal, 1, i),

View file

@ -12,10 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA; import de.ellpeck.actuallyadditions.mod.items.base.*;
import de.ellpeck.actuallyadditions.mod.items.base.ItemHoeAA;
import de.ellpeck.actuallyadditions.mod.items.base.ItemSeed;
import de.ellpeck.actuallyadditions.mod.items.base.ItemSwordAA;
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens; import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
@ -27,9 +24,11 @@ import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil; import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
public final class InitItems{ public final class InitItems{
@ -273,13 +272,13 @@ public final class InitItems{
itemHairyBall = new ItemHairyBall("itemHairyBall"); itemHairyBall = new ItemHairyBall("itemHairyBall");
itemCoffeeBean = new ItemCoffeeBean("itemCoffeeBeans"); itemCoffeeBean = new ItemCoffeeBean("itemCoffeeBeans");
itemRiceSeed = new ItemSeed("itemRiceSeed", "seedRice", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal()); itemRiceSeed = new ItemSeed("itemRiceSeed", "seedRice", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal());
CompatUtil.registerMFRSeed(itemRiceSeed); CompatUtil.registerMFRSeed(itemRiceSeed, InitBlocks.blockRice);
itemCanolaSeed = new ItemSeed("itemCanolaSeed", "seedCanola", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal()); itemCanolaSeed = new ItemFoodSeed("itemCanolaSeed", "seedCanola", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal(), 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F);
CompatUtil.registerMFRSeed(itemCanolaSeed); CompatUtil.registerMFRSeed(itemCanolaSeed, InitBlocks.blockCanola);
itemFlaxSeed = new ItemSeed("itemFlaxSeed", "seedFlax", InitBlocks.blockFlax, Items.STRING, 0); itemFlaxSeed = new ItemSeed("itemFlaxSeed", "seedFlax", InitBlocks.blockFlax, Items.STRING, 0);
CompatUtil.registerMFRSeed(itemFlaxSeed); CompatUtil.registerMFRSeed(itemFlaxSeed, InitBlocks.blockFlax);
itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", "seedCoffeeBeans", InitBlocks.blockCoffee, itemCoffeeBean, 0); itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", "seedCoffeeBeans", InitBlocks.blockCoffee, itemCoffeeBean, 0);
CompatUtil.registerMFRSeed(itemCoffeeSeed); CompatUtil.registerMFRSeed(itemCoffeeSeed, InitBlocks.blockCoffee);
itemPickaxeEmerald = new ItemPickaxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemPickaxeEmerald", EnumRarity.EPIC); itemPickaxeEmerald = new ItemPickaxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemPickaxeEmerald", EnumRarity.EPIC);
itemAxeEmerald = new ItemAxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemAxeEmerald", EnumRarity.EPIC); itemAxeEmerald = new ItemAxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemAxeEmerald", EnumRarity.EPIC);
itemShovelEmerald = new ItemShovelAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemShovelEmerald", EnumRarity.EPIC); itemShovelEmerald = new ItemShovelAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemShovelEmerald", EnumRarity.EPIC);

View file

@ -61,7 +61,6 @@ public class ItemFoods extends ItemFoodBase{
return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].useDuration; return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].useDuration;
} }
@Override @Override
public EnumAction getItemUseAction(ItemStack stack){ public EnumAction getItemUseAction(ItemStack stack){
return stack.getItemDamage() >= ALL_FOODS.length ? EnumAction.EAT : (ALL_FOODS[stack.getItemDamage()].getsDrunken ? EnumAction.DRINK : EnumAction.EAT); return stack.getItemDamage() >= ALL_FOODS.length ? EnumAction.EAT : (ALL_FOODS[stack.getItemDamage()].getsDrunken ? EnumAction.DRINK : EnumAction.EAT);

View file

@ -0,0 +1,81 @@
/*
* This file ("ItemFoodSeed.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeedFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class ItemFoodSeed extends ItemSeedFood{
public final Block plant;
public final String name;
public final String oredictName;
private final int maxUseDuration;
public ItemFoodSeed(String name, String oredictName, Block plant, Item returnItem, int returnMeta, int healAmount, float saturation, int maxUseDuration){
super(healAmount, saturation, plant, Blocks.FARMLAND);
this.name = name;
this.oredictName = oredictName;
this.plant = plant;
this.maxUseDuration = maxUseDuration;
if(plant instanceof BlockPlant){
((BlockPlant)plant).doStuff(this, returnItem, returnMeta);
}
this.register();
}
private void register(){
ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
this.registerRendering();
}
@Override
public int getMaxItemUseDuration(ItemStack stack){
return this.maxUseDuration;
}
protected String getBaseName(){
return this.name;
}
public boolean shouldAddCreative(){
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
public IBlockState getPlant(IBlockAccess world, BlockPos pos){
return this.plant.getDefaultState();
}
}

View file

@ -36,9 +36,7 @@ public class ItemSeed extends ItemSeeds{
this.plant = plant; this.plant = plant;
if(plant instanceof BlockPlant){ if(plant instanceof BlockPlant){
((BlockPlant)this.plant).seedItem = this; ((BlockPlant)plant).doStuff(this, returnItem, returnMeta);
((BlockPlant)this.plant).returnItem = returnItem;
((BlockPlant)this.plant).returnMeta = returnMeta;
} }
this.register(); this.register();
@ -62,13 +60,11 @@ public class ItemSeed extends ItemSeeds{
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE; return EnumRarity.RARE;
} }
@Override @Override
public IBlockState getPlant(IBlockAccess world, BlockPos pos){ public IBlockState getPlant(IBlockAccess world, BlockPos pos){
return this.plant.getDefaultState(); return this.plant.getDefaultState();

View file

@ -36,6 +36,8 @@ public enum TheMiscItems{
LENS("Lens", EnumRarity.UNCOMMON), LENS("Lens", EnumRarity.UNCOMMON),
ENDER_STAR("EnderStar", EnumRarity.EPIC), ENDER_STAR("EnderStar", EnumRarity.EPIC),
SPAWNER_SHARD("SpawnerShard", EnumRarity.EPIC), SPAWNER_SHARD("SpawnerShard", EnumRarity.EPIC),
BIOMASS("Biomass", EnumRarity.UNCOMMON),
BIOCOAL("Biocoal", EnumRarity.RARE),
YOUTUBE_ICON("YoutubeIcon", Util.FALLBACK_RARITY); YOUTUBE_ICON("YoutubeIcon", Util.FALLBACK_RARITY);
public final String name; public final String name;

View file

@ -39,6 +39,7 @@ public class FuelHandler implements IFuelHandler{
addFuel(InitItems.itemMisc, TheMiscItems.TINY_CHAR.ordinal(), 200); addFuel(InitItems.itemMisc, TheMiscItems.TINY_CHAR.ordinal(), 200);
addFuel(InitItems.itemMisc, TheMiscItems.TINY_COAL.ordinal(), 200); addFuel(InitItems.itemMisc, TheMiscItems.TINY_COAL.ordinal(), 200);
addFuel(InitBlocks.blockMisc, TheMiscBlocks.CHARCOAL_BLOCK.ordinal(), 16000); addFuel(InitBlocks.blockMisc, TheMiscBlocks.CHARCOAL_BLOCK.ordinal(), 16000);
addFuel(InitItems.itemMisc, TheMiscItems.BIOCOAL.ordinal(), 180);
} }
private static void addFuel(Item item, int metadata, int value){ private static void addFuel(Item item, int metadata, int value){

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.util.compat; package de.ellpeck.actuallyadditions.mod.util.compat;
import de.ellpeck.actuallyadditions.mod.items.base.ItemSeed;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -27,10 +26,10 @@ public final class CompatUtil{
FMLInterModComms.sendMessage("MineFactoryReloaded", "registerFertilizable_Crop", compound); FMLInterModComms.sendMessage("MineFactoryReloaded", "registerFertilizable_Crop", compound);
} }
public static void registerMFRSeed(Item item){ public static void registerMFRSeed(Item item, Block plant){
NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound compound = new NBTTagCompound();
compound.setString("seed", item.getRegistryName().toString()); compound.setString("seed", item.getRegistryName().toString());
compound.setString("crop", ((ItemSeed)item).plant.getRegistryName().toString()); compound.setString("crop", plant.getRegistryName().toString());
FMLInterModComms.sendMessage("MineFactoryReloaded", "registerPlantable_Crop", compound); FMLInterModComms.sendMessage("MineFactoryReloaded", "registerPlantable_Crop", compound);
} }

View file

@ -491,6 +491,8 @@ item.actuallyadditions.itemMiscSpawnerShard.name=Spawner Shards
item.actuallyadditions.itemMinecartFireworkBox.name=Firework Box Cart item.actuallyadditions.itemMinecartFireworkBox.name=Firework Box Cart
item.actuallyadditions.itemWaterBowl.name=Bowl of Water item.actuallyadditions.itemWaterBowl.name=Bowl of Water
item.actuallyadditions.itemFilter.name=Item Filter item.actuallyadditions.itemFilter.name=Item Filter
item.actuallyadditions.itemMiscBiomass.name=Biomass
item.actuallyadditions.itemMiscBiocoal.name=Bio Coal
#Tooltips #Tooltips
tooltip.actuallyadditions.onSuffix.desc=On tooltip.actuallyadditions.onSuffix.desc=On

View file

@ -0,0 +1,6 @@
{
"parent": "actuallyadditions:item/standardItem",
"textures": {
"layer0": "actuallyadditions:items/itemMiscBiocoal"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "actuallyadditions:item/standardItem",
"textures": {
"layer0": "actuallyadditions:items/itemMiscBiomass"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B