2015-12-03 20:15:07 +01:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("ItemBlockBase.java") is part of the Actually Additions mod for Minecraft.
|
2015-12-03 20:15:07 +01:00
|
|
|
* 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
|
2015-12-03 20:15:07 +01:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2015-12-03 20:15:07 +01:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
2015-12-03 20:15:07 +01:00
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
2015-12-03 20:15:07 +01:00
|
|
|
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;
|
2015-12-03 20:15:07 +01:00
|
|
|
|
2019-05-02 09:08:15 +02:00
|
|
|
public class ItemBlockBase extends ItemBlock {
|
2015-12-03 20:15:07 +01:00
|
|
|
|
2019-05-02 09:08:15 +02:00
|
|
|
public ItemBlockBase(Block block) {
|
2015-12-03 20:15:07 +01:00
|
|
|
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();
|
2015-12-03 20:15:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-02 09:08:15 +02:00
|
|
|
public int getMetadata(int damage) {
|
2015-12-03 20:15:07 +01:00
|
|
|
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 {
|
2015-12-03 20:15:07 +01:00
|
|
|
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
|
|
|
|
|
|
|
}
|
|
|
|
}
|