1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-09 09:52:59 +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

@@ -8,8 +8,8 @@ package dan200.computercraft;
import com.google.auto.service.AutoService;
import com.mojang.authlib.GameProfile;
import com.mojang.brigadier.arguments.ArgumentType;
import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.api.network.wired.IWiredElement;
import dan200.computercraft.api.filesystem.Mount;
import dan200.computercraft.api.network.wired.WiredElement;
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.impl.AbstractComputerCraftAPI;
import dan200.computercraft.impl.ComputerCraftAPIService;
@@ -139,7 +139,7 @@ public class TestPlatformHelper extends AbstractComputerCraftAPI implements Plat
}
@Override
public ComponentAccess<IWiredElement> createWiredElementAccess(Consumer<Direction> invalidate) {
public ComponentAccess<WiredElement> createWiredElementAccess(Consumer<Direction> invalidate) {
throw new UnsupportedOperationException("Cannot interact with the world inside tests");
}
@@ -226,7 +226,7 @@ public class TestPlatformHelper extends AbstractComputerCraftAPI implements Plat
@Nullable
@Override
public IMount createResourceMount(String domain, String subPath) {
public Mount createResourceMount(MinecraftServer server, String domain, String subPath) {
throw new UnsupportedOperationException("Cannot create resource mount");
}

View File

@@ -8,10 +8,10 @@ package dan200.computercraft.impl.network.wired;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.network.wired.IWiredElement;
import dan200.computercraft.api.network.wired.IWiredNetwork;
import dan200.computercraft.api.network.wired.IWiredNetworkChange;
import dan200.computercraft.api.network.wired.IWiredNode;
import dan200.computercraft.api.network.wired.WiredElement;
import dan200.computercraft.api.network.wired.WiredNetwork;
import dan200.computercraft.api.network.wired.WiredNetworkChange;
import dan200.computercraft.api.network.wired.WiredNode;
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.shared.util.DirectionUtil;
import net.minecraft.core.BlockPos;
@@ -36,7 +36,7 @@ public class NetworkTest {
bE = new NetworkElement(null, null, "b"),
cE = new NetworkElement(null, null, "c");
IWiredNode
WiredNode
aN = aE.getNode(),
bN = bE.getNode(),
cN = cE.getNode();
@@ -76,7 +76,7 @@ public class NetworkTest {
bE = new NetworkElement(null, null, "b"),
cE = new NetworkElement(null, null, "c");
IWiredNode
WiredNode
aN = aE.getNode(),
bN = bE.getNode(),
cN = cE.getNode();
@@ -103,7 +103,7 @@ public class NetworkTest {
bE = new NetworkElement(null, null, "b"),
cE = new NetworkElement(null, null, "c");
IWiredNode
WiredNode
aN = aE.getNode(),
bN = bE.getNode(),
cN = cE.getNode();
@@ -131,7 +131,7 @@ public class NetworkTest {
bE = new NetworkElement(null, null, "b"),
bbE = new NetworkElement(null, null, "b_");
IWiredNode
WiredNode
aN = aE.getNode(),
aaN = aaE.getNode(),
bN = bE.getNode(),
@@ -172,7 +172,7 @@ public class NetworkTest {
bE = new NetworkElement(null, null, "b"),
cE = new NetworkElement(null, null, "c");
IWiredNode
WiredNode
aN = aE.getNode(),
bN = bE.getNode(),
cN = cE.getNode();
@@ -203,7 +203,7 @@ public class NetworkTest {
bbE = new NetworkElement(null, null, "b_"),
cE = new NetworkElement(null, null, "c");
IWiredNode
WiredNode
aN = aE.getNode(),
aaN = aaE.getNode(),
bN = bE.getNode(),
@@ -238,7 +238,7 @@ public class NetworkTest {
@Test
@Disabled("Takes a long time to run, mostly for stress testing")
public void testLarge() {
var grid = new Grid<IWiredNode>(BRUTE_SIZE);
var grid = new Grid<WiredNode>(BRUTE_SIZE);
grid.map((existing, pos) -> new NetworkElement(null, null, "n_" + pos).getNode());
// Test connecting
@@ -297,11 +297,11 @@ public class NetworkTest {
}
}
private static final class NetworkElement implements IWiredElement {
private static final class NetworkElement implements WiredElement {
private final Level world;
private final Vec3 position;
private final String id;
private final IWiredNode node;
private final WiredNode node;
private final Map<String, IPeripheral> localPeripherals = Maps.newHashMap();
private final Map<String, IPeripheral> remotePeripherals = Maps.newHashMap();
@@ -334,12 +334,12 @@ public class NetworkTest {
}
@Override
public IWiredNode getNode() {
public WiredNode getNode() {
return node;
}
@Override
public void networkChanged(IWiredNetworkChange change) {
public void networkChanged(WiredNetworkChange change) {
remotePeripherals.keySet().removeAll(change.peripheralsRemoved().keySet());
remotePeripherals.putAll(change.peripheralsAdded());
}
@@ -406,11 +406,11 @@ public class NetworkTest {
}
}
private static Set<WiredNode> nodes(IWiredNetwork network) {
return ((WiredNetwork) network).nodes;
private static Set<WiredNodeImpl> nodes(WiredNetwork network) {
return ((WiredNetworkImpl) network).nodes;
}
private static Set<WiredNode> neighbours(IWiredNode node) {
return ((WiredNode) node).neighbours;
private static Set<WiredNodeImpl> neighbours(WiredNode node) {
return ((WiredNodeImpl) node).neighbours;
}
}

View File

@@ -5,7 +5,7 @@
*/
package dan200.computercraft.shared.computer.core;
import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.api.filesystem.Mount;
import net.minecraft.Util;
import net.minecraft.server.packs.FolderPackResources;
import net.minecraft.server.packs.PackType;
@@ -25,7 +25,7 @@ import java.util.concurrent.CompletableFuture;
import static org.junit.jupiter.api.Assertions.*;
public class ResourceMountTest {
private IMount mount;
private Mount mount;
@BeforeEach
public void before() {