1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-27 03:47:38 +00:00

Initial pass of the API breaking changes for 1.19.3 (#1232)

- Remove deprecated API members in prep for 1.19.3. This allows us to
   remove the mc-stubs and forge-stubs projects.

 - Make several methods take a MinecraftServer instead of a Level (or
   nothing at all).

 - Remove I prefixes from a whole bunch of interfaces, making things a
   little more consistent with Java conventions.

   This avoids touching the "main" interfaces people consume for now. I
   want to do that another Minecraft version, to avoid making the update
   too painful.

 - Remove IFileSystem and associated getters. This has never worked very
   well and I don't think has got much (any?) usage.
This commit is contained in:
Jonathan Coates
2022-12-03 15:02:00 +00:00
committed by GitHub
parent 95c57e843d
commit 87c6d3aef6
157 changed files with 619 additions and 1272 deletions

View File

@@ -5,7 +5,7 @@
*/
package dan200.computercraft.core;
import dan200.computercraft.api.filesystem.IWritableMount;
import dan200.computercraft.api.filesystem.WritableMount;
import dan200.computercraft.api.lua.ILuaAPI;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
@@ -85,7 +85,7 @@ public class ComputerTestDelegate {
if (Files.deleteIfExists(REPORT_PATH)) LOG.info("Deleted previous coverage report.");
var term = new Terminal(80, 100, true);
IWritableMount mount = new FileMount(TestFiles.get("mount").toFile(), 10_000_000);
WritableMount mount = new FileMount(TestFiles.get("mount").toFile(), 10_000_000);
// Remove any existing files
List<String> children = new ArrayList<>();

View File

@@ -50,7 +50,7 @@ public class ObjectWrapper implements ILuaContext {
}
@Override
public long issueMainThreadTask(ILuaTask task) {
public long issueMainThreadTask(LuaTask task) {
throw new IllegalStateException("Method should never queue events");
}
}

View File

@@ -240,7 +240,7 @@ public class GeneratorTest {
private static final ILuaContext CONTEXT = new ILuaContext() {
@Override
public long issueMainThreadTask(ILuaTask task) {
public long issueMainThreadTask(LuaTask task) {
return 0;
}
};

View File

@@ -5,7 +5,7 @@
*/
package dan200.computercraft.core.computer;
import dan200.computercraft.api.filesystem.IWritableMount;
import dan200.computercraft.api.filesystem.WritableMount;
import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.ILuaAPI;
import dan200.computercraft.api.lua.LuaException;
@@ -45,7 +45,7 @@ public class ComputerBootstrap {
}, maxTimes);
}
public static void run(IWritableMount mount, Consumer<Computer> setup, int maxTicks) {
public static void run(WritableMount mount, Consumer<Computer> setup, int maxTicks) {
CoreConfig.maxMainComputerTime = CoreConfig.maxMainGlobalTime = Integer.MAX_VALUE;
var term = new Terminal(51, 19, true);

View File

@@ -7,7 +7,7 @@ package dan200.computercraft.core.filesystem;
import com.google.common.io.MoreFiles;
import com.google.common.io.RecursiveDeleteOption;
import dan200.computercraft.api.filesystem.IWritableMount;
import dan200.computercraft.api.filesystem.WritableMount;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
@@ -39,11 +39,11 @@ public class FileMountTest {
return path;
}
private IWritableMount getExisting(long capacity) throws IOException {
private WritableMount getExisting(long capacity) throws IOException {
return new FileMount(createRoot().toFile(), capacity);
}
private IWritableMount getNotExisting(long capacity) throws IOException {
private WritableMount getNotExisting(long capacity) throws IOException {
return new FileMount(createRoot().resolve("mount").toFile(), capacity);
}

View File

@@ -6,7 +6,7 @@
package dan200.computercraft.core.filesystem;
import com.google.common.io.Files;
import dan200.computercraft.api.filesystem.IWritableMount;
import dan200.computercraft.api.filesystem.WritableMount;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.core.TestFiles;
import dan200.computercraft.core.apis.ObjectWrapper;
@@ -27,7 +27,7 @@ public class FileSystemTest {
private static final long CAPACITY = 1000000;
private static FileSystem mkFs() throws FileSystemException {
IWritableMount writableMount = new FileMount(ROOT, CAPACITY);
WritableMount writableMount = new FileMount(ROOT, CAPACITY);
return new FileSystem("hdd", writableMount);
}
@@ -65,7 +65,7 @@ public class FileSystemTest {
@Test
public void testUnmountCloses() throws FileSystemException {
var fs = mkFs();
IWritableMount mount = new FileMount(new File(ROOT, "child"), CAPACITY);
WritableMount mount = new FileMount(new File(ROOT, "child"), CAPACITY);
fs.mountWritable("disk", "disk", mount);
var writer = fs.openForWrite("disk/out.txt", false, EncodedWritableHandle::openUtf8);

View File

@@ -6,7 +6,7 @@
package dan200.computercraft.core.filesystem;
import com.google.common.io.ByteStreams;
import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.api.filesystem.Mount;
import dan200.computercraft.core.TestFiles;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -45,21 +45,21 @@ public class JarMountTest {
@Test
public void mountsDir() throws IOException {
IMount mount = new JarMount(ZIP_FILE, "dir");
Mount mount = new JarMount(ZIP_FILE, "dir");
assertTrue(mount.isDirectory(""), "Root should be directory");
assertTrue(mount.exists("file.lua"), "File should exist");
}
@Test
public void mountsFile() throws IOException {
IMount mount = new JarMount(ZIP_FILE, "dir/file.lua");
Mount mount = new JarMount(ZIP_FILE, "dir/file.lua");
assertTrue(mount.exists(""), "Root should exist");
assertFalse(mount.isDirectory(""), "Root should be a file");
}
@Test
public void opensFileFromFile() throws IOException {
IMount mount = new JarMount(ZIP_FILE, "dir/file.lua");
Mount mount = new JarMount(ZIP_FILE, "dir/file.lua");
byte[] contents;
try (var stream = mount.openForRead("")) {
contents = ByteStreams.toByteArray(Channels.newInputStream(stream));
@@ -70,7 +70,7 @@ public class JarMountTest {
@Test
public void opensFileFromDir() throws IOException {
IMount mount = new JarMount(ZIP_FILE, "dir");
Mount mount = new JarMount(ZIP_FILE, "dir");
byte[] contents;
try (var stream = mount.openForRead("file.lua")) {
contents = ByteStreams.toByteArray(Channels.newInputStream(stream));