mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
51 lines
1.9 KiB
Java
51 lines
1.9 KiB
Java
/**
|
|
* This class was created by <Vazkii>. It's distributed as
|
|
* part of the Botania Mod. Get the Source Code in github:
|
|
* https://github.com/Vazkii/Botania
|
|
*
|
|
* Botania is Open Source and distributed under the
|
|
* Botania License: http://botaniamod.net/license.php
|
|
*
|
|
* File Created @ [Jan 16, 2014, 5:54:06 PM (GMT)]
|
|
*/
|
|
package vazkii.botania.common.item.block;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.entity.item.EntityItem;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.inventory.IInventory;
|
|
import net.minecraft.item.ItemBlock;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.stats.Achievement;
|
|
import vazkii.botania.client.lib.LibResources;
|
|
import vazkii.botania.common.achievement.ICraftAchievement;
|
|
import vazkii.botania.common.achievement.IPickupAchievement;
|
|
// todo 1.8 revalidate this (used to extend ItemBlockWithMetadata which got removed)
|
|
public class ItemBlockWithMetadataAndName extends ItemBlock implements IPickupAchievement, ICraftAchievement {
|
|
|
|
public ItemBlockWithMetadataAndName(Block par2Block) {
|
|
super(par2Block);
|
|
}
|
|
|
|
@Override
|
|
public String getUnlocalizedNameInefficiently(ItemStack par1ItemStack) {
|
|
return super.getUnlocalizedNameInefficiently(par1ItemStack).replaceAll("tile.", "tile." + LibResources.PREFIX_MOD);
|
|
}
|
|
|
|
@Override
|
|
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
|
return super.getUnlocalizedName(par1ItemStack) + par1ItemStack.getItemDamage();
|
|
}
|
|
|
|
@Override
|
|
public Achievement getAchievementOnCraft(ItemStack stack, EntityPlayer player, IInventory matrix) {
|
|
return block instanceof ICraftAchievement ? ((ICraftAchievement) block).getAchievementOnCraft(stack, player, matrix) : null;
|
|
}
|
|
|
|
@Override
|
|
public Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item) {
|
|
return block instanceof IPickupAchievement ? ((IPickupAchievement) block).getAchievementOnPickup(stack, player, item) : null;
|
|
}
|
|
|
|
}
|