ActuallyAdditions/src/main/java/ellpeck/actuallyadditions/items/ItemBooklet.java

76 lines
2.4 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
* This file ("ItemBooklet.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2015-11-02 20:55:19 +01:00
* © 2015 Ellpeck
2015-08-29 14:33:25 +02:00
*/
2015-08-28 21:17:09 +02:00
package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
2015-11-13 20:34:57 +01:00
import ellpeck.actuallyadditions.achievement.TheAchievements;
2015-08-28 21:17:09 +02:00
import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
2015-08-28 21:17:09 +02:00
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
2015-08-28 21:17:09 +02:00
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
public class ItemBooklet extends Item implements IActAddItemOrBlock{
2015-08-28 21:17:09 +02:00
public ItemBooklet(){
2015-10-17 16:03:26 +02:00
this.setMaxStackSize(16);
2015-08-28 21:17:09 +02:00
this.setMaxDamage(0);
}
@Override
2015-10-03 10:19:40 +02:00
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
2015-11-13 20:34:57 +01:00
if(!world.isRemote){
player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach);
}
2015-10-03 10:19:40 +02:00
return stack;
2015-08-28 21:17:09 +02:00
}
@Override
2015-10-03 10:19:40 +02:00
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
2015-08-28 21:17:09 +02:00
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
2015-10-02 16:48:01 +02:00
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
2015-08-28 21:17:09 +02:00
}
@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc"));
}
2015-08-28 21:17:09 +02:00
@Override
2015-10-03 10:19:40 +02:00
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;
2015-08-28 21:17:09 +02:00
}
@Override
2015-10-03 10:19:40 +02:00
public String getName(){
return "itemBooklet";
2015-08-28 21:17:09 +02:00
}
}