-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1399482
commit 9c9c30d
Showing
5 changed files
with
152 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/eleksploded/ldcompathelper/ClientProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.eleksploded.ldcompathelper; | ||
|
||
import net.minecraftforge.fml.client.registry.ClientRegistry; | ||
|
||
public class ClientProxy extends CommonProxy { | ||
|
||
@Override | ||
public void register(){ | ||
ClientRegistry.registerKeyBinding(LDCompatHelper.key); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/eleksploded/ldcompathelper/CommonProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.eleksploded.ldcompathelper; | ||
|
||
public class CommonProxy { | ||
public void register() { | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
src/main/java/com/eleksploded/ldcompathelper/ErrorCheckerThread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.eleksploded.ldcompathelper; | ||
|
||
import java.io.File; | ||
import java.nio.file.Files; | ||
import java.nio.file.attribute.PosixFilePermission; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.common.DimensionManager; | ||
|
||
public class ErrorCheckerThread extends Thread { | ||
public boolean error = false; | ||
public World world; | ||
File worldDir; | ||
|
||
public ErrorCheckerThread(World worldIn){ | ||
world = worldIn; | ||
} | ||
|
||
public void run() { | ||
while(!error){ | ||
worldDir = DimensionManager.getCurrentSaveRootDirectory() == null ? worldDir : DimensionManager.getCurrentSaveRootDirectory(); | ||
|
||
if(world.isRemote){ | ||
//System.out.println("Client"); | ||
break; | ||
} else { | ||
//System.out.println("Server"); | ||
} | ||
|
||
try{ | ||
if(Minecraft.getMinecraft().getIntegratedServer() == null) { | ||
onError(); | ||
} | ||
} catch (java.lang.NoSuchMethodError e) { | ||
|
||
} | ||
if(error){ | ||
break; | ||
} | ||
} | ||
} | ||
|
||
public void onError() { | ||
error = true; | ||
System.out.println("Crash Detected"); | ||
File file = new File(worldDir + "/" + "LDCompat_FileTest"); | ||
try{ | ||
file.createNewFile(); | ||
Files.write(file.toPath(), buildList()); | ||
|
||
} catch(Exception e){ | ||
|
||
} | ||
try { | ||
Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file.toPath()); | ||
for(PosixFilePermission perm : perms){ | ||
System.out.println(perm.toString()); | ||
} | ||
} catch (Exception e1) { | ||
e1.printStackTrace(); | ||
} | ||
} | ||
|
||
private List<String> buildList() { | ||
List<String> list = new ArrayList<String>(); | ||
for(int i = 0; i < 150; i++){ | ||
list.add(String.valueOf(i)); | ||
} | ||
return list; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters