mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-30 02:38:34 +01:00
Fix PersistentClientData
This commit is contained in:
parent
58454f25ed
commit
606a0d80a4
1 changed files with 16 additions and 6 deletions
|
@ -87,9 +87,21 @@ public class PersistentClientData{
|
||||||
theFile = file;
|
theFile = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File getTheFile(){
|
||||||
|
try{
|
||||||
|
if(!theFile.exists()){
|
||||||
|
theFile.createNewFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
ModUtil.LOGGER.fatal("Couldn't create Persistent Variables file!", e);
|
||||||
|
}
|
||||||
|
return theFile;
|
||||||
|
}
|
||||||
|
|
||||||
private static NBTTagCompound readCompound(){
|
private static NBTTagCompound readCompound(){
|
||||||
try{
|
try{
|
||||||
return CompressedStreamTools.readCompressed(new FileInputStream(theFile));
|
return CompressedStreamTools.readCompressed(new FileInputStream(getTheFile()));
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
return new NBTTagCompound();
|
return new NBTTagCompound();
|
||||||
|
@ -98,13 +110,11 @@ public class PersistentClientData{
|
||||||
|
|
||||||
private static void writeCompound(NBTTagCompound compound){
|
private static void writeCompound(NBTTagCompound compound){
|
||||||
try{
|
try{
|
||||||
if(!theFile.exists()){
|
|
||||||
theFile.createNewFile();
|
CompressedStreamTools.writeCompressed(compound, new FileOutputStream(getTheFile()));
|
||||||
}
|
|
||||||
CompressedStreamTools.writeCompressed(compound, new FileOutputStream(theFile));
|
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
ModUtil.LOGGER.fatal("Couldn't write Persistant Variable!", e);
|
ModUtil.LOGGER.fatal("Couldn't write Persistent Variable!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue