Skip to content

Commit

Permalink
fix for server sided crash reported on forum
Browse files Browse the repository at this point in the history
  • Loading branch information
progwml6 committed Feb 23, 2014
1 parent 9874908 commit 96dcde4
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions src/main/java/tconstruct/items/Manual.java
Expand Up @@ -34,27 +34,31 @@ public Manual()
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
{
player.addStat(TAchievements.achievements.get("tconstruct.beginner"), 1);
player.openGui(TConstruct.instance, mantle.client.MProxyClient.manualGuiID, world, 0, 0, 0);
Side side = FMLCommonHandler.instance().getEffectiveSide();
if (side.isClient())
FMLClientHandler.instance().displayGuiScreen(player, new GuiManual(stack, getData(stack)));
return stack;
Side side = FMLCommonHandler.instance().getEffectiveSide();
if (side.isClient())
{
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;
default:
return TProxyClient.manualData.diary;
}
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;
default:
return TProxyClient.manualData.diary;
}
}

@Override
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
Expand Down

0 comments on commit 96dcde4

Please sign in to comment.