ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java

52 lines
1.6 KiB
Java
Raw Normal View History

/*
* 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
*
2017-01-01 16:23:26 +01:00
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.init.Blocks;
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;
2019-05-02 09:10:29 +02:00
public class ItemFoodSeed extends ItemSeedFood {
public final Block plant;
public final String name;
public final String oredictName;
private final int maxUseDuration;
2019-05-02 09:10:29 +02:00
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;
2019-05-02 09:10:29 +02:00
if (plant instanceof BlockPlant) {
((BlockPlant) plant).doStuff(this, returnItem, returnMeta);
}
}
@Override
2019-05-02 09:10:29 +02:00
public int getMaxItemUseDuration(ItemStack stack) {
return this.maxUseDuration;
}
@Override
2021-02-26 22:15:48 +01:00
public BlockState getPlant(IBlockAccess world, BlockPos pos) {
return this.plant.defaultBlockState();
}
}