-
Notifications
You must be signed in to change notification settings - Fork 754
/
Manual.java
77 lines (69 loc) · 2.56 KB
/
Manual.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package tconstruct.tools.items;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import mantle.books.BookData;
import mantle.client.gui.GuiManual;
import mantle.items.abstracts.CraftingItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import tconstruct.TConstruct;
import tconstruct.achievements.TAchievements;
import tconstruct.client.TProxyClient;
import tconstruct.library.TConstructRegistry;
public class Manual extends CraftingItem
{
static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary", "weaponry" };
static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery", "tinkerbook_blue", "tinkerbook_green" };
public Manual()
{
super(name, textureName, "", "tinker", TConstructRegistry.materialTab);
setUnlocalizedName("tconstruct.manual");
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
{
TAchievements.triggerAchievement(player, "tconstruct.beginner");
Side side = FMLCommonHandler.instance().getEffectiveSide();
player.openGui(TConstruct.instance, mantle.client.MProxyClient.manualGuiID, world, 0, 0, 0);
FMLClientHandler.instance().displayGuiScreen(player, new GuiManual(stack, getData(stack)));
return stack;
}
private BookData getData (ItemStack stack)
{
switch (stack.getItemDamage())
{
case 0:
return TProxyClient.manualData.beginner;
case 1:
return TProxyClient.manualData.toolStation;
case 2:
return TProxyClient.manualData.smeltery;
case 4:
return TProxyClient.manualData.weaponry;
default:
return TProxyClient.manualData.diary;
}
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 0:
list.add("\u00a7o" + StatCollector.translateToLocal("manual1.tooltip"));
break;
case 1:
list.add("\u00a7o" + StatCollector.translateToLocal("manual2.tooltip"));
break;
case 2:
list.add("\u00a7o" + StatCollector.translateToLocal("manual3.tooltip"));
break;
}
}
}