This commit is contained in:
Ellpeck 2015-09-30 06:56:33 +02:00
parent 2aa2e547c8
commit e2006d2b81
6 changed files with 17 additions and 17 deletions

View file

@ -19,7 +19,7 @@ import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.StringUtil;
import ellpeck.actuallyadditions.util.playerdata.PersistantClientData; import ellpeck.actuallyadditions.util.playerdata.PersistentClientData;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
@ -133,7 +133,7 @@ public class GuiBooklet extends GuiScreen{
@Override @Override
public void onGuiClosed(){ public void onGuiClosed(){
PersistantClientData.saveBookPage(this.currentIndexEntry, this.currentChapter, this.currentPage, this.pageOpenInIndex); PersistentClientData.saveBookPage(this.currentIndexEntry, this.currentChapter, this.currentPage, this.pageOpenInIndex);
} }
@Override @Override
@ -178,14 +178,14 @@ public class GuiBooklet extends GuiScreen{
this.currentChapter = null; this.currentChapter = null;
this.currentIndexEntry = null; this.currentIndexEntry = null;
if(!PersistantClientData.getBoolean("BookAlreadyOpened")){ if(!PersistentClientData.getBoolean("BookAlreadyOpened")){
this.openIndexEntry(InitBooklet.chapterIntro.entry, 1, true); this.openIndexEntry(InitBooklet.chapterIntro.entry, 1, true);
this.openChapter(InitBooklet.chapterIntro, null); this.openChapter(InitBooklet.chapterIntro, null);
PersistantClientData.setBoolean("BookAlreadyOpened", true); PersistentClientData.setBoolean("BookAlreadyOpened", true);
} }
else{ else{
PersistantClientData.openLastBookPage(this); PersistentClientData.openLastBookPage(this);
} }
} }

View file

@ -17,7 +17,7 @@ import ellpeck.actuallyadditions.achievement.TheAchievements;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.playerdata.PersistantServerData; import ellpeck.actuallyadditions.util.playerdata.PersistentServerData;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -31,7 +31,7 @@ public class CraftEvent{
if(ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()){ 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)){ 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); PersistentServerData data = PersistentServerData.get(event.player);
if(data != null && !data.bookGottenAlready){ if(data != null && !data.bookGottenAlready){
data.bookGottenAlready = true; data.bookGottenAlready = true;

View file

@ -12,7 +12,7 @@ package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.playerdata.PersistantServerData; import ellpeck.actuallyadditions.util.playerdata.PersistentServerData;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.EntityEvent;
@ -21,8 +21,8 @@ public class EntityConstructingEvent{
@SubscribeEvent @SubscribeEvent
public void onEntityConstructing(EntityEvent.EntityConstructing event){ public void onEntityConstructing(EntityEvent.EntityConstructing event){
if(event.entity instanceof EntityPlayer){ if(event.entity instanceof EntityPlayer){
if(PersistantServerData.get((EntityPlayer)event.entity) == null){ if(PersistentServerData.get((EntityPlayer)event.entity) == null){
event.entity.registerExtendedProperties(ModUtil.MOD_ID, new PersistantServerData()); event.entity.registerExtendedProperties(ModUtil.MOD_ID, new PersistentServerData());
} }
} }
} }

View file

@ -25,7 +25,7 @@ import ellpeck.actuallyadditions.tile.*;
import ellpeck.actuallyadditions.util.AssetUtil; import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.KeyBinds; import ellpeck.actuallyadditions.util.KeyBinds;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.playerdata.PersistantClientData; import ellpeck.actuallyadditions.util.playerdata.PersistentClientData;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -40,7 +40,7 @@ public class ClientProxy implements IProxy{
public void preInit(FMLPreInitializationEvent event){ public void preInit(FMLPreInitializationEvent event){
ModUtil.LOGGER.info("PreInitializing ClientProxy..."); ModUtil.LOGGER.info("PreInitializing ClientProxy...");
PersistantClientData.setTheFile(new File(Minecraft.getMinecraft().mcDataDir, ModUtil.MOD_ID+"Data.dat")); PersistentClientData.setTheFile(new File(Minecraft.getMinecraft().mcDataDir, ModUtil.MOD_ID+"Data.dat"));
KeyBinds.init(); KeyBinds.init();
} }

View file

@ -27,7 +27,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class PersistantClientData{ public class PersistentClientData{
private static File theFile; private static File theFile;

View file

@ -18,7 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.common.IExtendedEntityProperties;
public class PersistantServerData implements IExtendedEntityProperties{ public class PersistentServerData implements IExtendedEntityProperties{
public boolean bookGottenAlready; public boolean bookGottenAlready;
@ -46,10 +46,10 @@ public class PersistantServerData implements IExtendedEntityProperties{
} }
public static PersistantServerData get(EntityPlayer player){ public static PersistentServerData get(EntityPlayer player){
IExtendedEntityProperties properties = player.getExtendedProperties(ModUtil.MOD_ID); IExtendedEntityProperties properties = player.getExtendedProperties(ModUtil.MOD_ID);
if(properties != null && properties instanceof PersistantServerData){ if(properties != null && properties instanceof PersistentServerData){
return (PersistantServerData)properties; return (PersistentServerData)properties;
} }
return null; return null;
} }