ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java
2019-05-02 03:08:15 -04:00

51 lines
1.3 KiB
Java

/*
* This file ("ItemBlockBase.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-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.IRarity;
public class ItemBlockBase extends ItemBlock {
public ItemBlockBase(Block block) {
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getTranslationKey(ItemStack stack) {
return this.getTranslationKey();
}
@Override
public int getMetadata(int damage) {
return damage;
}
@Override
public IRarity getForgeRarity(ItemStack stack) {
if (this.block instanceof ICustomRarity) {
return ((ICustomRarity) this.block).getRarity(stack);
} else {
return Util.FALLBACK_RARITY;
}
}
public interface ICustomRarity {
IRarity getRarity(ItemStack stack);
}
}