Valkyrien Skies (Forge/Fabric)

Valkyrien Skies (Forge/Fabric)

3M Downloads

VSGameUtilsKt compile error with Fabric Loom client/common split

jc776 opened this issue ยท 0 comments

commented

New versions of Fabric Loom require splitEnvironmentSourceSets, which splits into src/main/client that can use client code and src/main/java that cannot.

Game Version: Fabric 1.20.1
Mod version: 1.20.1 2.1.3-beta.2+9ed2ddedcc

	modImplementation("org.valkyrienskies:valkyrienskies-120-fabric:2.1.3-beta.2+9ed2ddedcc") {
	  exclude(group: "net.fabricmc.fabric-api")
	}

VSGameUtils refers to both server and client code, so any use of it from src/main/java is failing to find client classes, even for uses that are purely serverside.

> Configure project :
Fabric Loom: 1.3.10

> Task :compileJava FAILED
/.../src/main/java/io/github/jc776/assembly/VehicleSearch.java:123: error: cannot access ClientLevel
		ServerShipWorld shipObjects = VSGameUtilsKt.getShipObjectWorld(level);
		                                           ^
  class file for net.minecraft.client.multiplayer.ClientLevel not found
/.../src/main/java/io/github/jc776/assembly/VehicleSubAssembly.java:36: error: cannot access Minecraft
		var ship = VSGameUtilsKt.getShipObjectWorld(level).createNewShipAtBlock(
		                        ^
  class file for net.minecraft.client.Minecraft not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

From my server-only code:

	public static Info findShipAtPosition(final ServerLevel level,
			final BlockPos searchPos) {
...
ServerShipWorld shipObjects = VSGameUtilsKt.getShipObjectWorld(level);
public class VehicleSubAssembly {
	public static ServerShip assemble(BlockPos centerBlock,
			DenseBlockPosSet blocks, ServerLevel level,
			ServerShip originalShip) {

		if (blocks.isEmpty())
			throw new IllegalArgumentException();

		var centerVec = VectorConversionsMCKt.toJOML(centerBlock);
		var ship = VSGameUtilsKt.getShipObjectWorld(level).createNewShipAtBlock(
				centerVec, false, 1.0, VSGameUtilsKt.getDimensionId(level));