mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 05:33:00 +00:00 
			
		
		
		
	Merge branch 'mc-1.20.x' into mc-1.21.x
This commit is contained in:
		
							
								
								
									
										6
									
								
								.github/ISSUE_TEMPLATE/bug_report.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/ISSUE_TEMPLATE/bug_report.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -8,10 +8,8 @@ body: | |||||||
|     label: Minecraft Version |     label: Minecraft Version | ||||||
|     description: What version of Minecraft are you using? |     description: What version of Minecraft are you using? | ||||||
|     options: |     options: | ||||||
|       - 1.16.x |       - 1.20.1 | ||||||
|       - 1.18.x |       - 1.21.x | ||||||
|       - 1.19.x |  | ||||||
|       - 1.20.x |  | ||||||
|   validations: |   validations: | ||||||
|     required: true |     required: true | ||||||
| - type: input | - type: input | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ on is present. | |||||||
| ```groovy | ```groovy | ||||||
| repositories { | repositories { | ||||||
|   maven { |   maven { | ||||||
|     url "https://squiddev.cc/maven/" |     url "https://maven.squiddev.cc" | ||||||
|     content { |     content { | ||||||
|       includeGroup("cc.tweaked") |       includeGroup("cc.tweaked") | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ repositories { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     maven("https://squiddev.cc/maven") { |     maven("https://maven.squiddev.cc") { | ||||||
|         name = "SquidDev" |         name = "SquidDev" | ||||||
|         content { |         content { | ||||||
|             includeGroup("cc.tweaked.vanilla-extract") |             includeGroup("cc.tweaked.vanilla-extract") | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ java { | |||||||
| repositories { | repositories { | ||||||
|     mavenCentral() |     mavenCentral() | ||||||
| 
 | 
 | ||||||
|     val mainMaven = maven("https://squiddev.cc/maven") { |     val mainMaven = maven("https://maven.squiddev.cc/mirror") { | ||||||
|         name = "SquidDev" |         name = "SquidDev" | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -133,8 +133,8 @@ tasks.processResources { | |||||||
| tasks.withType(AbstractArchiveTask::class.java).configureEach { | tasks.withType(AbstractArchiveTask::class.java).configureEach { | ||||||
|     isPreserveFileTimestamps = false |     isPreserveFileTimestamps = false | ||||||
|     isReproducibleFileOrder = true |     isReproducibleFileOrder = true | ||||||
|     dirMode = Integer.valueOf("755", 8) |     filePermissions {} | ||||||
|     fileMode = Integer.valueOf("664", 8) |     dirPermissions {} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| tasks.jar { | tasks.jar { | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ publishing { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     repositories { |     repositories { | ||||||
|         maven("https://squiddev.cc/maven") { |         maven("https://maven.squiddev.cc") { | ||||||
|             name = "SquidDev" |             name = "SquidDev" | ||||||
| 
 | 
 | ||||||
|             credentials(PasswordCredentials::class) |             credentials(PasswordCredentials::class) | ||||||
|   | |||||||
| @@ -25,13 +25,13 @@ as documentation for breaking changes and "gotchas" one should look out for betw | |||||||
| 
 | 
 | ||||||
|  - Update to Lua 5.2: |  - Update to Lua 5.2: | ||||||
|    - Support for Lua 5.0's pseudo-argument `arg` has been removed. You should always use `...` for varargs. |    - Support for Lua 5.0's pseudo-argument `arg` has been removed. You should always use `...` for varargs. | ||||||
|    - Environments are no longer baked into the runtime, and instead use the `_ENV` local or upvalue. `getfenv`/`setfenv` |    - Environments are no longer baked into the runtime, and instead use the `_ENV` local or upvalue. [`getfenv`]/[`setfenv`] | ||||||
|      now only work on Lua functions with an `_ENV` upvalue. `getfenv` will return the global environment when called |      now only work on Lua functions with an `_ENV` upvalue. [`getfenv`] will return the global environment when called | ||||||
|      with other functions, and `setfenv` will have no effect. |      with other functions, and [`setfenv`] will have no effect. | ||||||
|    - `load`/`loadstring` defaults to using the global environment (`_G`) rather than the current coroutine's |    - [`load`]/[`loadstring`] defaults to using the global environment (`_G`) rather than the current coroutine's | ||||||
|      environment. |      environment. | ||||||
|    - Support for dumping functions (`string.dump`) and loading binary chunks has been removed. |    - Support for dumping functions ([`string.dump`]) and loading binary chunks has been removed. | ||||||
|    - `math.random` now uses Lua 5.4's random number generator. |    - [`math.random`] now uses Lua 5.4's random number generator. | ||||||
| 
 | 
 | ||||||
|  - File handles, HTTP requests and websockets now always use the original bytes rather than encoding/decoding to UTF-8. |  - File handles, HTTP requests and websockets now always use the original bytes rather than encoding/decoding to UTF-8. | ||||||
| 
 | 
 | ||||||
| @@ -44,7 +44,7 @@ as documentation for breaking changes and "gotchas" one should look out for betw | |||||||
|    `keys.enter` constant was queued when the key was pressed) |    `keys.enter` constant was queued when the key was pressed) | ||||||
| 
 | 
 | ||||||
|  - Minecraft 1.13 removed the concept of item damage and block metadata (see ["The Flattening"][flattening]). As a |  - Minecraft 1.13 removed the concept of item damage and block metadata (see ["The Flattening"][flattening]). As a | ||||||
|    result `turtle.inspect` no longer provides block metadata, and `turtle.getItemDetail` no longer provides damage. |    result [`turtle.inspect`] no longer provides block metadata, and [`turtle.getItemDetail`] no longer provides damage. | ||||||
| 
 | 
 | ||||||
|    - Block states (`turtle.inspect().state`) should provide all the same information as block metadata, but in a much |    - Block states (`turtle.inspect().state`) should provide all the same information as block metadata, but in a much | ||||||
|      more understandable format. |      more understandable format. | ||||||
| @@ -70,7 +70,7 @@ as documentation for breaking changes and "gotchas" one should look out for betw | |||||||
|  - Unlabelled computers and turtles now keep their ID when broken, meaning that unlabelled computers/items do not stack. |  - Unlabelled computers and turtles now keep their ID when broken, meaning that unlabelled computers/items do not stack. | ||||||
| 
 | 
 | ||||||
| ## ComputerCraft 1.80pr1 {#cc-1.80} | ## ComputerCraft 1.80pr1 {#cc-1.80} | ||||||
|  - Programs run via `shell.run` are now started in their own isolated environment. This means globals set by programs |  - Programs run via [`shell.run`] are now started in their own isolated environment. This means globals set by programs | ||||||
|    will not be accessible outside of this program. |    will not be accessible outside of this program. | ||||||
| 
 | 
 | ||||||
|  - Programs containing `/` are looked up in the current directory and are no longer looked up on the path. For instance, |  - Programs containing `/` are looked up in the current directory and are no longer looked up on the path. For instance, | ||||||
|   | |||||||
| @@ -60,7 +60,7 @@ checkstyle = "10.14.1" | |||||||
| curseForgeGradle = "1.1.18" | curseForgeGradle = "1.1.18" | ||||||
| errorProne-core = "2.27.0" | errorProne-core = "2.27.0" | ||||||
| errorProne-plugin = "3.1.0" | errorProne-plugin = "3.1.0" | ||||||
| fabric-loom = "1.6.7" | fabric-loom = "1.7.1" | ||||||
| githubRelease = "2.5.2" | githubRelease = "2.5.2" | ||||||
| gradleVersions = "0.50.0" | gradleVersions = "0.50.0" | ||||||
| ideaExt = "1.1.7" | ideaExt = "1.1.7" | ||||||
| @@ -71,7 +71,7 @@ neoGradle = "7.0.145" | |||||||
| nullAway = "0.10.25" | nullAway = "0.10.25" | ||||||
| spotless = "6.23.3" | spotless = "6.23.3" | ||||||
| taskTree = "2.1.1" | taskTree = "2.1.1" | ||||||
| teavm = "0.10.0-SQUID.4" | teavm = "0.11.0-SQUID.1" | ||||||
| vanillaExtract = "0.1.3" | vanillaExtract = "0.1.3" | ||||||
| versionCatalogUpdate = "0.8.1" | versionCatalogUpdate = "0.8.1" | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| distributionBase=GRADLE_USER_HOME | distributionBase=GRADLE_USER_HOME | ||||||
| distributionPath=wrapper/dists | distributionPath=wrapper/dists | ||||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip | ||||||
| networkTimeout=10000 | networkTimeout=10000 | ||||||
| validateDistributionUrl=true | validateDistributionUrl=true | ||||||
| zipStoreBase=GRADLE_USER_HOME | zipStoreBase=GRADLE_USER_HOME | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								gradlew
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradlew
									
									
									
									
										vendored
									
									
								
							| @@ -55,7 +55,7 @@ | |||||||
| #       Darwin, MinGW, and NonStop. | #       Darwin, MinGW, and NonStop. | ||||||
| # | # | ||||||
| #   (3) This script is generated from the Groovy template | #   (3) This script is generated from the Groovy template | ||||||
| #       https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt | #       https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt | ||||||
| #       within the Gradle project. | #       within the Gradle project. | ||||||
| # | # | ||||||
| #       You can find Gradle at https://github.com/gradle/gradle/. | #       You can find Gradle at https://github.com/gradle/gradle/. | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ package dan200.computercraft.shared.computer.core; | |||||||
| import com.google.common.annotations.VisibleForTesting; | import com.google.common.annotations.VisibleForTesting; | ||||||
| import dan200.computercraft.api.filesystem.FileOperationException; | import dan200.computercraft.api.filesystem.FileOperationException; | ||||||
| import dan200.computercraft.core.filesystem.ArchiveMount; | import dan200.computercraft.core.filesystem.ArchiveMount; | ||||||
| import dan200.computercraft.core.filesystem.FileSystem; |  | ||||||
| import net.minecraft.ResourceLocationException; | import net.minecraft.ResourceLocationException; | ||||||
| import net.minecraft.resources.ResourceLocation; | import net.minecraft.resources.ResourceLocation; | ||||||
| import net.minecraft.server.MinecraftServer; | import net.minecraft.server.MinecraftServer; | ||||||
| @@ -65,9 +64,10 @@ public final class ResourceMount extends ArchiveMount<ResourceMount.FileEntry> { | |||||||
|             existingNamespace = file.getNamespace(); |             existingNamespace = file.getNamespace(); | ||||||
| 
 | 
 | ||||||
|             if (!file.getNamespace().equals(namespace)) continue; |             if (!file.getNamespace().equals(namespace)) continue; | ||||||
|             if (!FileSystem.contains(subPath, file.getPath())) continue; // Some packs seem to include the parent? |  | ||||||
| 
 | 
 | ||||||
|             var localPath = FileSystem.toLocal(file.getPath(), subPath); |             var localPath = getLocalPath(file.getPath(), subPath); | ||||||
|  |             if (localPath == null) continue; | ||||||
|  | 
 | ||||||
|             try { |             try { | ||||||
|                 getOrCreateChild(newRoot, localPath, this::createEntry); |                 getOrCreateChild(newRoot, localPath, this::createEntry); | ||||||
|             } catch (ResourceLocationException e) { |             } catch (ResourceLocationException e) { | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|     "elements": [ |     "elements": [ | ||||||
|         { |         { | ||||||
|             "name": "Flag", |             "name": "Flag", | ||||||
| 			"from": [1.5, 13, 10.5], |             "from": [1.5, 13.5, 10.5], | ||||||
|             "to": [2, 16.5, 15.5], |             "to": [2, 16.5, 15.5], | ||||||
|             "rotation": {"angle": 22.5, "axis": "x", "origin": [2, 11, 10.75]}, |             "rotation": {"angle": 22.5, "axis": "x", "origin": [2, 11, 10.75]}, | ||||||
|             "faces": { |             "faces": { | ||||||
| @@ -22,7 +22,7 @@ | |||||||
|         { |         { | ||||||
|             "name": "Stick", |             "name": "Stick", | ||||||
|             "from": [1.5, 10.5, 10.5], |             "from": [1.5, 10.5, 10.5], | ||||||
| 			"to": [2, 13, 11], |             "to": [2, 13.5, 11], | ||||||
|             "rotation": {"angle": 22.5, "axis": "x", "origin": [2, 11, 10.75]}, |             "rotation": {"angle": 22.5, "axis": "x", "origin": [2, 11, 10.75]}, | ||||||
|             "faces": { |             "faces": { | ||||||
|                 "north": {"uv": [12, 0, 13, 6], "texture": "#texture"}, |                 "north": {"uv": [12, 0, 13, 6], "texture": "#texture"}, | ||||||
| @@ -33,6 +33,5 @@ | |||||||
|                 "down": {"uv": [13, 6, 14, 7], "texture": "#texture"} |                 "down": {"uv": [13, 6, 14, 7], "texture": "#texture"} | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 	], |     ] | ||||||
| 	"display": {} |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
|         { |         { | ||||||
|             "name": "Flag", |             "name": "Flag", | ||||||
|             "from": [1.5, 13.5, 10.5], |             "from": [1.5, 13.5, 10.5], | ||||||
| 			"to": [2, 16.5, 15.5], |             "to": [2, 16, 15.5], | ||||||
|             "rotation": {"angle": 22.5, "axis": "x", "origin": [2, 11, 10.75]}, |             "rotation": {"angle": 22.5, "axis": "x", "origin": [2, 11, 10.75]}, | ||||||
|             "faces": { |             "faces": { | ||||||
|                 "north": {"uv": [0, 0, 1, 5], "texture": "#texture"}, |                 "north": {"uv": [0, 0, 1, 5], "texture": "#texture"}, | ||||||
| @@ -33,6 +33,5 @@ | |||||||
|                 "down": {"uv": [13, 6, 14, 7], "texture": "#texture"} |                 "down": {"uv": [13, 6, 14, 7], "texture": "#texture"} | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 	], |     ] | ||||||
| 	"display": {} |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -175,9 +175,9 @@ public class OSAPI implements ILuaAPI { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Sets an alarm that will fire at the specified in-game time. When it |      * Sets an alarm that will fire at the specified {@linkplain #time(IArguments) in-game time}. | ||||||
|      * fires, * an {@code alarm} event will be added to the event queue with the |      * When it fires, an {@code alarm} event will be added to the event queue with the | ||||||
|      * ID * returned from this function as the first parameter. |      * ID returned from this function as the first parameter. | ||||||
|      * |      * | ||||||
|      * @param time The time at which to fire the alarm, in the range [0.0, 24.0). |      * @param time The time at which to fire the alarm, in the range [0.0, 24.0). | ||||||
|      * @return The ID of the new alarm. This can be used to filter the |      * @return The ID of the new alarm. This can be used to filter the | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
| package dan200.computercraft.core.computer.computerthread; | package dan200.computercraft.core.computer.computerthread; | ||||||
| 
 | 
 | ||||||
| import com.google.common.annotations.VisibleForTesting; | import com.google.common.annotations.VisibleForTesting; | ||||||
|  | import com.google.errorprone.annotations.Keep; | ||||||
| import dan200.computercraft.core.ComputerContext; | import dan200.computercraft.core.ComputerContext; | ||||||
| import dan200.computercraft.core.Logging; | import dan200.computercraft.core.Logging; | ||||||
| import dan200.computercraft.core.computer.TimeoutState; | import dan200.computercraft.core.computer.TimeoutState; | ||||||
| @@ -774,6 +775,7 @@ public final class ComputerThread implements ComputerScheduler { | |||||||
|         /** |         /** | ||||||
|          * The current state of this worker. |          * The current state of this worker. | ||||||
|          */ |          */ | ||||||
|  |         @Keep | ||||||
|         private volatile ExecutorState $state = ExecutorState.IDLE; |         private volatile ExecutorState $state = ExecutorState.IDLE; | ||||||
| 
 | 
 | ||||||
|         /** |         /** | ||||||
| @@ -784,6 +786,7 @@ public final class ComputerThread implements ComputerScheduler { | |||||||
|          * {@linkplain #afterWork()} finishes executing, we set this back to null and compute the difference between the |          * {@linkplain #afterWork()} finishes executing, we set this back to null and compute the difference between the | ||||||
|          * two, updating the {@link Metrics#JAVA_ALLOCATION} metric. |          * two, updating the {@link Metrics#JAVA_ALLOCATION} metric. | ||||||
|          */ |          */ | ||||||
|  |         @Keep | ||||||
|         private volatile @Nullable ThreadAllocation $threadAllocation = null; |         private volatile @Nullable ThreadAllocation $threadAllocation = null; | ||||||
| 
 | 
 | ||||||
|         /** |         /** | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ import com.google.common.cache.Cache; | |||||||
| import com.google.common.cache.CacheBuilder; | import com.google.common.cache.CacheBuilder; | ||||||
| import dan200.computercraft.core.apis.handles.ArrayByteChannel; | import dan200.computercraft.core.apis.handles.ArrayByteChannel; | ||||||
| 
 | 
 | ||||||
|  | import javax.annotation.Nullable; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.nio.channels.SeekableByteChannel; | import java.nio.channels.SeekableByteChannel; | ||||||
| import java.util.concurrent.TimeUnit; | import java.util.concurrent.TimeUnit; | ||||||
| @@ -82,6 +83,24 @@ public abstract class ArchiveMount<T extends ArchiveMount.FileEntry<T>> extends | |||||||
|      */ |      */ | ||||||
|     protected abstract byte[] getFileContents(String path, T file) throws IOException; |     protected abstract byte[] getFileContents(String path, T file) throws IOException; | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Convert an absolute path to one relative to {@code root}. If this path is not a child of {@code root}, return | ||||||
|  |      * {@code null}. | ||||||
|  |      * | ||||||
|  |      * @param path The full path. | ||||||
|  |      * @param root The root directory to be relative to. | ||||||
|  |      * @return The relativised path, or {@code null}. | ||||||
|  |      */ | ||||||
|  |     protected static @Nullable String getLocalPath(String path, String root) { | ||||||
|  |         // Some packs seem to include files not under the root, so drop them immediately. | ||||||
|  |         if (!path.startsWith(root)) return null; | ||||||
|  | 
 | ||||||
|  |         if (path.length() == root.length()) return ""; | ||||||
|  | 
 | ||||||
|  |         if (path.charAt(root.length()) != '/') return null; | ||||||
|  |         return path.substring(root.length() + 1); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     protected static class FileEntry<T extends FileEntry<T>> extends AbstractInMemoryMount.FileEntry<T> { |     protected static class FileEntry<T extends FileEntry<T>> extends AbstractInMemoryMount.FileEntry<T> { | ||||||
|         long size = -1; |         long size = -1; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -224,11 +224,11 @@ public class FileSystem { | |||||||
|     public synchronized void copy(String sourcePath, String destPath) throws FileSystemException { |     public synchronized void copy(String sourcePath, String destPath) throws FileSystemException { | ||||||
|         sourcePath = sanitizePath(sourcePath); |         sourcePath = sanitizePath(sourcePath); | ||||||
|         destPath = sanitizePath(destPath); |         destPath = sanitizePath(destPath); | ||||||
|         if (isReadOnly(destPath)) throw new FileSystemException("/" + destPath + ": " + ACCESS_DENIED); |         if (isReadOnly(destPath)) throw new FileSystemException(destPath, ACCESS_DENIED); | ||||||
|         if (!exists(sourcePath)) throw new FileSystemException("/" + sourcePath + ": " + NO_SUCH_FILE); |         if (!exists(sourcePath)) throw new FileSystemException(sourcePath, NO_SUCH_FILE); | ||||||
|         if (exists(destPath)) throw new FileSystemException("/" + destPath + ": " + FILE_EXISTS); |         if (exists(destPath)) throw new FileSystemException(destPath, FILE_EXISTS); | ||||||
|         if (contains(sourcePath, destPath)) { |         if (contains(sourcePath, destPath)) { | ||||||
|             throw new FileSystemException("/" + sourcePath + ": Can't copy a directory inside itself"); |             throw new FileSystemException(sourcePath, "Can't copy a directory inside itself"); | ||||||
|         } |         } | ||||||
|         copyRecursive(sourcePath, getMount(sourcePath), destPath, getMount(destPath), 0); |         copyRecursive(sourcePath, getMount(sourcePath), destPath, getMount(destPath), 0); | ||||||
|     } |     } | ||||||
| @@ -341,7 +341,7 @@ public class FileSystem { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (match == null) { |         if (match == null) { | ||||||
|             throw new FileSystemException("/" + path + ": Invalid Path"); |             throw new FileSystemException(path, "Invalid Path"); | ||||||
|         } |         } | ||||||
|         return match; |         return match; | ||||||
|     } |     } | ||||||
| @@ -404,7 +404,7 @@ public class FileSystem { | |||||||
|         return String.join("/", outputParts); |         return String.join("/", outputParts); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static boolean contains(String pathA, String pathB) { |     private static boolean contains(String pathA, String pathB) { | ||||||
|         pathA = sanitizePath(pathA).toLowerCase(Locale.ROOT); |         pathA = sanitizePath(pathA).toLowerCase(Locale.ROOT); | ||||||
|         pathB = sanitizePath(pathB).toLowerCase(Locale.ROOT); |         pathB = sanitizePath(pathB).toLowerCase(Locale.ROOT); | ||||||
| 
 | 
 | ||||||
| @@ -421,7 +421,7 @@ public class FileSystem { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static String toLocal(String path, String location) { |     static String toLocal(String path, String location) { | ||||||
|         path = sanitizePath(path); |         path = sanitizePath(path); | ||||||
|         location = sanitizePath(location); |         location = sanitizePath(location); | ||||||
| 
 | 
 | ||||||
|   | |||||||
| @@ -13,8 +13,12 @@ public class FileSystemException extends Exception { | |||||||
|     @Serial |     @Serial | ||||||
|     private static final long serialVersionUID = -2500631644868104029L; |     private static final long serialVersionUID = -2500631644868104029L; | ||||||
| 
 | 
 | ||||||
|     FileSystemException(String s) { |     FileSystemException(String message) { | ||||||
|         super(s); |         super(message); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     FileSystemException(String path, String message) { | ||||||
|  |         this("/" + path + ": " + message); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static FileSystemException of(IOException e) { |     public static FileSystemException of(IOException e) { | ||||||
|   | |||||||
| @@ -49,10 +49,9 @@ public final class JarMount extends ArchiveMount<JarMount.FileEntry> implements | |||||||
|         while (zipEntries.hasMoreElements()) { |         while (zipEntries.hasMoreElements()) { | ||||||
|             var entry = zipEntries.nextElement(); |             var entry = zipEntries.nextElement(); | ||||||
| 
 | 
 | ||||||
|             var entryPath = entry.getName(); |             var localPath = getLocalPath(entry.getName(), subPath); | ||||||
|             if (!entryPath.startsWith(subPath)) continue; |             if (localPath == null) continue; | ||||||
| 
 | 
 | ||||||
|             var localPath = FileSystem.toLocal(entryPath, subPath); |  | ||||||
|             getOrCreateChild(root, localPath, x -> new FileEntry()).setup(entry); |             getOrCreateChild(root, localPath, x -> new FileEntry()).setup(entry); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -129,7 +129,7 @@ class MountWrapper { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public void makeDirectory(String path) throws FileSystemException { |     public void makeDirectory(String path) throws FileSystemException { | ||||||
|         if (writableMount == null) throw exceptionOf(path, ACCESS_DENIED); |         if (writableMount == null) throw new FileSystemException(path, ACCESS_DENIED); | ||||||
| 
 | 
 | ||||||
|         path = toLocal(path); |         path = toLocal(path); | ||||||
|         try { |         try { | ||||||
| @@ -140,7 +140,7 @@ class MountWrapper { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public void delete(String path) throws FileSystemException { |     public void delete(String path) throws FileSystemException { | ||||||
|         if (writableMount == null) throw exceptionOf(path, ACCESS_DENIED); |         if (writableMount == null) throw new FileSystemException(path, ACCESS_DENIED); | ||||||
| 
 | 
 | ||||||
|         path = toLocal(path); |         path = toLocal(path); | ||||||
|         try { |         try { | ||||||
| @@ -151,7 +151,7 @@ class MountWrapper { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public void rename(String source, String dest) throws FileSystemException { |     public void rename(String source, String dest) throws FileSystemException { | ||||||
|         if (writableMount == null) throw exceptionOf(source, ACCESS_DENIED); |         if (writableMount == null) throw new FileSystemException(source, ACCESS_DENIED); | ||||||
| 
 | 
 | ||||||
|         source = toLocal(source); |         source = toLocal(source); | ||||||
|         dest = toLocal(dest); |         dest = toLocal(dest); | ||||||
| @@ -168,7 +168,7 @@ class MountWrapper { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public SeekableByteChannel openForWrite(String path, Set<OpenOption> options) throws FileSystemException { |     public SeekableByteChannel openForWrite(String path, Set<OpenOption> options) throws FileSystemException { | ||||||
|         if (writableMount == null) throw exceptionOf(path, ACCESS_DENIED); |         if (writableMount == null) throw new FileSystemException(path, ACCESS_DENIED); | ||||||
| 
 | 
 | ||||||
|         path = toLocal(path); |         path = toLocal(path); | ||||||
|         try { |         try { | ||||||
| @@ -206,10 +206,6 @@ class MountWrapper { | |||||||
| 
 | 
 | ||||||
|     private FileSystemException localExceptionOf(String path, String message) { |     private FileSystemException localExceptionOf(String path, String message) { | ||||||
|         if (!location.isEmpty()) path = path.isEmpty() ? location : location + "/" + path; |         if (!location.isEmpty()) path = path.isEmpty() ? location : location + "/" + path; | ||||||
|         return exceptionOf(path, message); |         return new FileSystemException(path, message); | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     private static FileSystemException exceptionOf(String path, String message) { |  | ||||||
|         return new FileSystemException("/" + path + ": " + message); |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -360,13 +360,13 @@ public class Main { | |||||||
| 
 | 
 | ||||||
|         // And our VBA |         // And our VBA | ||||||
|         var termVertexArray = gl.createVertexArray("Terminal VAO"); |         var termVertexArray = gl.createVertexArray("Terminal VAO"); | ||||||
|         glEnableVertexArrayAttrib(termVertexArray, 0); |         glEnableVertexArrayAttrib(termVertexArray, ATTRIBUTE_POSITION); | ||||||
|         glVertexArrayAttribFormat(termVertexArray, 0, 2, GL_FLOAT, false, 0); // Position |         glVertexArrayAttribFormat(termVertexArray, ATTRIBUTE_POSITION, 2, GL_FLOAT, false, 0); // Position | ||||||
|         glEnableVertexArrayAttrib(termVertexArray, 1); |         glEnableVertexArrayAttrib(termVertexArray, ATTRIBUTE_UV); | ||||||
|         glVertexArrayAttribFormat(termVertexArray, 1, 2, GL_FLOAT, false, 8); // UV |         glVertexArrayAttribFormat(termVertexArray, ATTRIBUTE_UV, 2, GL_FLOAT, false, 8); // UV | ||||||
|         // FIXME: Can we merge this into one call? |         // FIXME: Can we merge this into one call? | ||||||
|         glVertexArrayVertexBuffer(termVertexArray, 0, termVertices, 0, 16); |         glVertexArrayVertexBuffer(termVertexArray, ATTRIBUTE_POSITION, termVertices, 0, 16); | ||||||
|         glVertexArrayVertexBuffer(termVertexArray, 1, termVertices, 0, 16); |         glVertexArrayVertexBuffer(termVertexArray, ATTRIBUTE_UV, termVertices, 0, 16); | ||||||
| 
 | 
 | ||||||
|         glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |         glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | ||||||
| 
 | 
 | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ pluginManagement { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         maven("https://squiddev.cc/maven") { |         maven("https://maven.squiddev.cc") { | ||||||
|             name = "SquidDev" |             name = "SquidDev" | ||||||
|             content { |             content { | ||||||
|                 includeGroup("cc.tweaked.vanilla-extract") |                 includeGroup("cc.tweaked.vanilla-extract") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jonathan Coates
					Jonathan Coates