diff --git a/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java b/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java index 4aa1a1f1c..e2e53c3f7 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java @@ -32,7 +32,7 @@ public class CraftEvent{ if(ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()){ if(!event.player.worldObj.isRemote && event.crafting.getItem() != InitItems.itemLexicon && (event.crafting.getItem() instanceof INameableItem || Block.getBlockFromItem(event.crafting.getItem()) instanceof INameableItem)){ PersistantServerData data = PersistantServerData.get(event.player); - if(!data.bookGottenAlready){ + if(data != null && !data.bookGottenAlready){ data.bookGottenAlready = true; EntityItem entityItem = new EntityItem(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ, new ItemStack(InitItems.itemLexicon)); diff --git a/src/main/java/ellpeck/actuallyadditions/util/playerdata/PersistantServerData.java b/src/main/java/ellpeck/actuallyadditions/util/playerdata/PersistantServerData.java index 420dd0d39..01d782b14 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/playerdata/PersistantServerData.java +++ b/src/main/java/ellpeck/actuallyadditions/util/playerdata/PersistantServerData.java @@ -47,6 +47,10 @@ public class PersistantServerData implements IExtendedEntityProperties{ } public static PersistantServerData get(EntityPlayer player){ - return (PersistantServerData)player.getExtendedProperties(ModUtil.MOD_ID); + IExtendedEntityProperties properties = player.getExtendedProperties(ModUtil.MOD_ID); + if(properties != null && properties instanceof PersistantServerData){ + return (PersistantServerData)properties; + } + return null; } }