diff --git a/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java b/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java index 9ffea1a..6d787a1 100644 --- a/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java +++ b/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java @@ -2010,4 +2010,16 @@ public class EaglerAdapterImpl2 { } } + public static final boolean immediateContinueSupported() { + return false; + } + + public static final void immediateContinue() { + // + } + + public static final List serverLANGetAllEvent(String clientId) { + return null; + } + } diff --git a/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/vfs/VFile.java b/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/vfs/VFile.java new file mode 100644 index 0000000..ea3d5ae --- /dev/null +++ b/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/vfs/VFile.java @@ -0,0 +1,80 @@ +package net.lax1dude.eaglercraft.adapter.vfs; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Comparator; +import java.util.stream.Stream; + +public class VFile extends File { + + public VFile(String pathname) { + super(pathname); + } + + public VFile(String parent, String child) { + super(parent, child); + } + + public VFile(File parent, String child) { + super(parent, child); + } + + public VFile(String parent, String child, String child2) { + super(new VFile(parent, child), child2); + } + + public InputStream getInputStream() { + try { + return Files.newInputStream(this.toPath()); + } catch (IOException e) { + return null; + } + } + + public String[] getAllLines() { + try { + return Files.readAllLines(this.toPath(), StandardCharsets.UTF_8).toArray(new String[0]); + } catch (IOException e) { + return null; + } + } + + public String getAllChars() { + try { + return Files.readString(this.toPath(), StandardCharsets.UTF_8); + } catch (IOException e) { + return null; + } + } + + public boolean setAllChars(String chars) { + return setAllBytes(chars.getBytes(StandardCharsets.UTF_8)); + } + + public boolean setAllBytes(byte[] bytes) { + try { + if (this.getParentFile() != null) { + this.getParentFile().mkdirs(); + } + Files.write(this.toPath(), bytes); + return true; + } catch (IOException e) { + return false; + } + } + + public int deleteAll() { + try (Stream pathStream = Files.walk(this.toPath())) { + pathStream.sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + return 1; + } catch (IOException e) { + return 0; + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiTexturePacks.java b/src/main/java/net/minecraft/src/GuiTexturePacks.java index 5156491..e483c1a 100644 --- a/src/main/java/net/minecraft/src/GuiTexturePacks.java +++ b/src/main/java/net/minecraft/src/GuiTexturePacks.java @@ -3,7 +3,7 @@ package net.minecraft.src; import net.lax1dude.eaglercraft.EPKDecompiler; import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerInputStream; -import net.lax1dude.eaglercraft.adapter.teavm.vfs.VFile; +import net.lax1dude.eaglercraft.adapter.vfs.VFile; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/src/main/java/net/minecraft/src/TexturePackFolder.java b/src/main/java/net/minecraft/src/TexturePackFolder.java index 408e597..e59c756 100644 --- a/src/main/java/net/minecraft/src/TexturePackFolder.java +++ b/src/main/java/net/minecraft/src/TexturePackFolder.java @@ -1,6 +1,6 @@ package net.minecraft.src; -import net.lax1dude.eaglercraft.adapter.teavm.vfs.VFile; +import net.lax1dude.eaglercraft.adapter.vfs.VFile; import java.io.IOException; import java.io.InputStream; diff --git a/src/main/java/net/minecraft/src/TexturePackImplementation.java b/src/main/java/net/minecraft/src/TexturePackImplementation.java index 83408ab..f3e896d 100644 --- a/src/main/java/net/minecraft/src/TexturePackImplementation.java +++ b/src/main/java/net/minecraft/src/TexturePackImplementation.java @@ -8,8 +8,7 @@ import java.io.InputStreamReader; import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerImage; import net.lax1dude.eaglercraft.EaglerInputStream; -import net.lax1dude.eaglercraft.EaglerMisc; -import net.lax1dude.eaglercraft.adapter.teavm.vfs.VFile; +import net.lax1dude.eaglercraft.adapter.vfs.VFile; public abstract class TexturePackImplementation implements ITexturePack { diff --git a/src/main/java/net/minecraft/src/TexturePackList.java b/src/main/java/net/minecraft/src/TexturePackList.java index 475f558..7c89d7c 100644 --- a/src/main/java/net/minecraft/src/TexturePackList.java +++ b/src/main/java/net/minecraft/src/TexturePackList.java @@ -14,7 +14,7 @@ import java.util.zip.ZipInputStream; import net.lax1dude.eaglercraft.EPKDecompiler; import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerInputStream; -import net.lax1dude.eaglercraft.adapter.teavm.vfs.VFile; +import net.lax1dude.eaglercraft.adapter.vfs.VFile; import net.minecraft.client.Minecraft; public class TexturePackList diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/BooleanResult.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/BooleanResult.java similarity index 86% rename from src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/BooleanResult.java rename to src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/BooleanResult.java index c967763..a956837 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/BooleanResult.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/BooleanResult.java @@ -1,4 +1,4 @@ -package net.lax1dude.eaglercraft.adapter.teavm.vfs; +package net.lax1dude.eaglercraft.adapter.vfs; public class BooleanResult { diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/SYS.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/SYS.java similarity index 86% rename from src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/SYS.java rename to src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/SYS.java index 482e4f3..303b084 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/SYS.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/SYS.java @@ -1,4 +1,4 @@ -package net.lax1dude.eaglercraft.adapter.teavm.vfs; +package net.lax1dude.eaglercraft.adapter.vfs; public class SYS { diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VFSIterator.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VFSIterator.java similarity index 83% rename from src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VFSIterator.java rename to src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VFSIterator.java index 128582a..34b3d0e 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VFSIterator.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VFSIterator.java @@ -1,4 +1,4 @@ -package net.lax1dude.eaglercraft.adapter.teavm.vfs; +package net.lax1dude.eaglercraft.adapter.vfs; public interface VFSIterator { diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VFile.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VFile.java similarity index 98% rename from src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VFile.java rename to src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VFile.java index 849681d..857a5db 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VFile.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VFile.java @@ -1,4 +1,4 @@ -package net.lax1dude.eaglercraft.adapter.teavm.vfs; +package net.lax1dude.eaglercraft.adapter.vfs; import java.io.InputStream; import java.io.OutputStream; diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VIteratorFile.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VIteratorFile.java similarity index 99% rename from src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VIteratorFile.java rename to src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VIteratorFile.java index e179e70..2dfa631 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VIteratorFile.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VIteratorFile.java @@ -1,4 +1,4 @@ -package net.lax1dude.eaglercraft.adapter.teavm.vfs; +package net.lax1dude.eaglercraft.adapter.vfs; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VirtualFilesystem.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VirtualFilesystem.java similarity index 99% rename from src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VirtualFilesystem.java rename to src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VirtualFilesystem.java index c9bb56b..1195923 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/vfs/VirtualFilesystem.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/vfs/VirtualFilesystem.java @@ -1,6 +1,5 @@ -package net.lax1dude.eaglercraft.adapter.teavm.vfs; +package net.lax1dude.eaglercraft.adapter.vfs; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream;