mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Added biomass and biocoal made from canola seeds and also made canola seeds edible
Closes #130
This commit is contained in:
parent
28c6e551d8
commit
ee9c94da74
15 changed files with 122 additions and 24 deletions
|
@ -35,8 +35,8 @@ public class BlockPlant extends BlockCrops{
|
|||
private final int minDropAmount;
|
||||
private final int addDropAmount;
|
||||
public Item seedItem;
|
||||
public Item returnItem;
|
||||
public int returnMeta;
|
||||
private Item returnItem;
|
||||
private int returnMeta;
|
||||
|
||||
public BlockPlant(String name, int minDropAmount, int addDropAmount){
|
||||
this.name = name;
|
||||
|
@ -45,6 +45,12 @@ public class BlockPlant extends BlockCrops{
|
|||
this.register();
|
||||
}
|
||||
|
||||
public void doStuff(Item seedItem, Item returnItem, int returnMeta){
|
||||
this.seedItem = seedItem;
|
||||
this.returnItem = returnItem;
|
||||
this.returnMeta = returnMeta;
|
||||
}
|
||||
|
||||
private void register(){
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
|
||||
|
@ -71,7 +77,6 @@ public class BlockPlant extends BlockCrops{
|
|||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
|
||||
return EnumPlantType.Crop;
|
||||
|
@ -110,7 +115,6 @@ public class BlockPlant extends BlockCrops{
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item getSeed(){
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item getCrop(){
|
||||
return this.returnItem;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
||||
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
||||
|
|
|
@ -29,6 +29,7 @@ public final class InitCrafting{
|
|||
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.itemCanolaSeed, 20), Blocks.DIRT, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()), Blocks.SOUL_SAND);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ public final class MiscCrafting{
|
|||
|
||||
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
|
||||
for(int i = 0; i < TheCrystals.values().length; i++){
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCrystal, 1, i),
|
||||
|
|
|
@ -12,10 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
|
||||
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.base.*;
|
||||
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||
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 net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public final class InitItems{
|
||||
|
||||
|
@ -273,13 +272,13 @@ public final class InitItems{
|
|||
itemHairyBall = new ItemHairyBall("itemHairyBall");
|
||||
itemCoffeeBean = new ItemCoffeeBean("itemCoffeeBeans");
|
||||
itemRiceSeed = new ItemSeed("itemRiceSeed", "seedRice", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal());
|
||||
CompatUtil.registerMFRSeed(itemRiceSeed);
|
||||
itemCanolaSeed = new ItemSeed("itemCanolaSeed", "seedCanola", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal());
|
||||
CompatUtil.registerMFRSeed(itemCanolaSeed);
|
||||
CompatUtil.registerMFRSeed(itemRiceSeed, InitBlocks.blockRice);
|
||||
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, InitBlocks.blockCanola);
|
||||
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);
|
||||
CompatUtil.registerMFRSeed(itemCoffeeSeed);
|
||||
CompatUtil.registerMFRSeed(itemCoffeeSeed, InitBlocks.blockCoffee);
|
||||
itemPickaxeEmerald = new ItemPickaxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemPickaxeEmerald", 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);
|
||||
|
|
|
@ -61,7 +61,6 @@ public class ItemFoods extends ItemFoodBase{
|
|||
return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].useDuration;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack){
|
||||
return stack.getItemDamage() >= ALL_FOODS.length ? EnumAction.EAT : (ALL_FOODS[stack.getItemDamage()].getsDrunken ? EnumAction.DRINK : EnumAction.EAT);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -36,9 +36,7 @@ public class ItemSeed extends ItemSeeds{
|
|||
this.plant = plant;
|
||||
|
||||
if(plant instanceof BlockPlant){
|
||||
((BlockPlant)this.plant).seedItem = this;
|
||||
((BlockPlant)this.plant).returnItem = returnItem;
|
||||
((BlockPlant)this.plant).returnMeta = returnMeta;
|
||||
((BlockPlant)plant).doStuff(this, returnItem, returnMeta);
|
||||
}
|
||||
|
||||
this.register();
|
||||
|
@ -62,13 +60,11 @@ public class ItemSeed extends ItemSeeds{
|
|||
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();
|
||||
|
|
|
@ -36,6 +36,8 @@ public enum TheMiscItems{
|
|||
LENS("Lens", EnumRarity.UNCOMMON),
|
||||
ENDER_STAR("EnderStar", EnumRarity.EPIC),
|
||||
SPAWNER_SHARD("SpawnerShard", EnumRarity.EPIC),
|
||||
BIOMASS("Biomass", EnumRarity.UNCOMMON),
|
||||
BIOCOAL("Biocoal", EnumRarity.RARE),
|
||||
YOUTUBE_ICON("YoutubeIcon", Util.FALLBACK_RARITY);
|
||||
|
||||
public final String name;
|
||||
|
|
|
@ -39,6 +39,7 @@ public class FuelHandler implements IFuelHandler{
|
|||
addFuel(InitItems.itemMisc, TheMiscItems.TINY_CHAR.ordinal(), 200);
|
||||
addFuel(InitItems.itemMisc, TheMiscItems.TINY_COAL.ordinal(), 200);
|
||||
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){
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.util.compat;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemSeed;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -27,10 +26,10 @@ public final class CompatUtil{
|
|||
FMLInterModComms.sendMessage("MineFactoryReloaded", "registerFertilizable_Crop", compound);
|
||||
}
|
||||
|
||||
public static void registerMFRSeed(Item item){
|
||||
public static void registerMFRSeed(Item item, Block plant){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -491,6 +491,8 @@ item.actuallyadditions.itemMiscSpawnerShard.name=Spawner Shards
|
|||
item.actuallyadditions.itemMinecartFireworkBox.name=Firework Box Cart
|
||||
item.actuallyadditions.itemWaterBowl.name=Bowl of Water
|
||||
item.actuallyadditions.itemFilter.name=Item Filter
|
||||
item.actuallyadditions.itemMiscBiomass.name=Biomass
|
||||
item.actuallyadditions.itemMiscBiocoal.name=Bio Coal
|
||||
|
||||
#Tooltips
|
||||
tooltip.actuallyadditions.onSuffix.desc=On
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "actuallyadditions:item/standardItem",
|
||||
"textures": {
|
||||
"layer0": "actuallyadditions:items/itemMiscBiocoal"
|
||||
}
|
||||
}
|
|
@ -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 |
Loading…
Reference in a new issue