mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 03:49:22 +01:00
Null checks are important!
This commit is contained in:
parent
d4e425fbd7
commit
b9fe715244
2 changed files with 6 additions and 2 deletions
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue