ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java

51 lines
1.3 KiB
Java
Raw Normal View History

/*
2016-05-16 22:52:27 +02:00
* 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
2016-05-16 22:52:27 +02:00
* 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
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod.blocks.base;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
2019-05-02 09:08:15 +02:00
import net.minecraftforge.common.IRarity;
2019-05-02 09:08:15 +02:00
public class ItemBlockBase extends ItemBlock {
2019-05-02 09:08:15 +02:00
public ItemBlockBase(Block block) {
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
2019-05-02 09:08:15 +02:00
public String getTranslationKey(ItemStack stack) {
2018-08-04 04:22:20 +02:00
return this.getTranslationKey();
}
@Override
2019-05-02 09:08:15 +02:00
public int getMetadata(int damage) {
return damage;
}
@Override
2019-05-02 09:08:15 +02:00
public IRarity getForgeRarity(ItemStack stack) {
if (this.block instanceof ICustomRarity) {
return ((ICustomRarity) this.block).getRarity(stack);
} else {
return Util.FALLBACK_RARITY;
}
}
2016-06-27 20:24:45 +02:00
2019-05-02 09:08:15 +02:00
public interface ICustomRarity {
2016-06-27 20:24:45 +02:00
2019-05-02 09:08:15 +02:00
IRarity getRarity(ItemStack stack);
2016-06-27 20:24:45 +02:00
}
}