Fix desktop runtime

This commit is contained in:
ayunami2000 2024-12-13 22:18:56 -05:00
parent 1e4d74a48c
commit f926392249
12 changed files with 102 additions and 12 deletions

View File

@ -2010,4 +2010,16 @@ public class EaglerAdapterImpl2 {
} }
} }
public static final boolean immediateContinueSupported() {
return false;
}
public static final void immediateContinue() {
//
}
public static final List<LANPeerEvent> serverLANGetAllEvent(String clientId) {
return null;
}
} }

View File

@ -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<Path> pathStream = Files.walk(this.toPath())) {
pathStream.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
return 1;
} catch (IOException e) {
return 0;
}
}
}

View File

@ -3,7 +3,7 @@ package net.minecraft.src;
import net.lax1dude.eaglercraft.EPKDecompiler; import net.lax1dude.eaglercraft.EPKDecompiler;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerInputStream; 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.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;

View File

@ -1,6 +1,6 @@
package net.minecraft.src; 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.IOException;
import java.io.InputStream; import java.io.InputStream;

View File

@ -8,8 +8,7 @@ import java.io.InputStreamReader;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerImage; import net.lax1dude.eaglercraft.EaglerImage;
import net.lax1dude.eaglercraft.EaglerInputStream; import net.lax1dude.eaglercraft.EaglerInputStream;
import net.lax1dude.eaglercraft.EaglerMisc; import net.lax1dude.eaglercraft.adapter.vfs.VFile;
import net.lax1dude.eaglercraft.adapter.teavm.vfs.VFile;
public abstract class TexturePackImplementation implements ITexturePack public abstract class TexturePackImplementation implements ITexturePack
{ {

View File

@ -14,7 +14,7 @@ import java.util.zip.ZipInputStream;
import net.lax1dude.eaglercraft.EPKDecompiler; import net.lax1dude.eaglercraft.EPKDecompiler;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerInputStream; 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; import net.minecraft.client.Minecraft;
public class TexturePackList public class TexturePackList

View File

@ -1,4 +1,4 @@
package net.lax1dude.eaglercraft.adapter.teavm.vfs; package net.lax1dude.eaglercraft.adapter.vfs;
public class BooleanResult { public class BooleanResult {

View File

@ -1,4 +1,4 @@
package net.lax1dude.eaglercraft.adapter.teavm.vfs; package net.lax1dude.eaglercraft.adapter.vfs;
public class SYS { public class SYS {

View File

@ -1,4 +1,4 @@
package net.lax1dude.eaglercraft.adapter.teavm.vfs; package net.lax1dude.eaglercraft.adapter.vfs;
public interface VFSIterator { public interface VFSIterator {

View File

@ -1,4 +1,4 @@
package net.lax1dude.eaglercraft.adapter.teavm.vfs; package net.lax1dude.eaglercraft.adapter.vfs;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;

View File

@ -1,4 +1,4 @@
package net.lax1dude.eaglercraft.adapter.teavm.vfs; package net.lax1dude.eaglercraft.adapter.vfs;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;

View File

@ -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.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;