diff --git a/tcdcommons-3-fabric-1.20.1/gradle.properties b/tcdcommons-3-fabric-1.20.1/gradle.properties index a7367c7d..6f191c50 100644 --- a/tcdcommons-3-fabric-1.20.1/gradle.properties +++ b/tcdcommons-3-fabric-1.20.1/gradle.properties @@ -27,7 +27,6 @@ org.gradle.jvmargs=-Xmx1G modmenu_link_curseforge = https://www.curseforge.com/projects/711539 modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 - modmenu_link_kofi = https://ko-fi.com/TheCSDev modmenu_link_youtube = https://www.youtube.com/@TheCSDev mod_license = LGPL-3.0-or-later diff --git a/tcdcommons-3-fabric-1.20.1/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java b/tcdcommons-3-fabric-1.20.1/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java index 876889aa..5d713e12 100644 --- a/tcdcommons-3-fabric-1.20.1/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java +++ b/tcdcommons-3-fabric-1.20.1/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java @@ -83,17 +83,22 @@ currPath.toFile() : currPath.getParent().toFile(); + final @Nullable var childDirectories = currFile.listFiles(File::isDirectory); + final @Nullable var childFiles = currFile.listFiles(File::isFile); + if(childDirectories == null || childFiles == null) + throw new SecurityException("Access denied."); + //add a "go back" list entry, allowing the user to navigate to the previous folder final var currFileParent = currFile.getParentFile(); if(currFileParent != null) addGoBackFileListItem(currFileParent); //iterate all child directories, and list them - for(final File childDir : currFile.listFiles(File::isDirectory)) + for(final File childDir : childDirectories) addFileListItem(childDir); //iterate all child non-directory files, and list them - for(final File childDir : currFile.listFiles(File::isFile)) - addFileListItem(childDir); + for(final File childFile : childFiles) + addFileListItem(childFile); } catch(SecurityException se) { diff --git a/tcdcommons-3-fabric-1.20.1/src/main/resources/assets/tcdcommons/icon.png b/tcdcommons-3-fabric-1.20.1/src/main/resources/assets/tcdcommons/icon.png index 88d8bc27..99cb3a84 100644 Binary files a/tcdcommons-3-fabric-1.20.1/src/main/resources/assets/tcdcommons/icon.png and b/tcdcommons-3-fabric-1.20.1/src/main/resources/assets/tcdcommons/icon.png differ diff --git a/tcdcommons-3-fabric-1.20.1/src/main/resources/fabric.mod.json b/tcdcommons-3-fabric-1.20.1/src/main/resources/fabric.mod.json index dbcea779..a73287b6 100644 --- a/tcdcommons-3-fabric-1.20.1/src/main/resources/fabric.mod.json +++ b/tcdcommons-3-fabric-1.20.1/src/main/resources/fabric.mod.json @@ -49,7 +49,6 @@ { "modmenu.curseforge": "${project.modmenu_link_curseforge}", "modmenu.modrinth": "${project.modmenu_link_modrinth}", - "modmenu.kofi": "${project.modmenu_link_kofi}", "modmenu.youtube": "${project.modmenu_link_youtube}" } } diff --git a/tcdcommons-3-fabric-1.20.2/gradle.properties b/tcdcommons-3-fabric-1.20.2/gradle.properties index f67d362e..a3e80628 100644 --- a/tcdcommons-3-fabric-1.20.2/gradle.properties +++ b/tcdcommons-3-fabric-1.20.2/gradle.properties @@ -27,7 +27,6 @@ org.gradle.jvmargs=-Xmx1G modmenu_link_curseforge = https://www.curseforge.com/projects/711539 modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 - modmenu_link_kofi = https://ko-fi.com/TheCSDev modmenu_link_youtube = https://www.youtube.com/@TheCSDev mod_license = LGPL-3.0-or-later diff --git a/tcdcommons-3-fabric-1.20.2/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java b/tcdcommons-3-fabric-1.20.2/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java index 876889aa..5d713e12 100644 --- a/tcdcommons-3-fabric-1.20.2/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java +++ b/tcdcommons-3-fabric-1.20.2/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java @@ -83,17 +83,22 @@ currPath.toFile() : currPath.getParent().toFile(); + final @Nullable var childDirectories = currFile.listFiles(File::isDirectory); + final @Nullable var childFiles = currFile.listFiles(File::isFile); + if(childDirectories == null || childFiles == null) + throw new SecurityException("Access denied."); + //add a "go back" list entry, allowing the user to navigate to the previous folder final var currFileParent = currFile.getParentFile(); if(currFileParent != null) addGoBackFileListItem(currFileParent); //iterate all child directories, and list them - for(final File childDir : currFile.listFiles(File::isDirectory)) + for(final File childDir : childDirectories) addFileListItem(childDir); //iterate all child non-directory files, and list them - for(final File childDir : currFile.listFiles(File::isFile)) - addFileListItem(childDir); + for(final File childFile : childFiles) + addFileListItem(childFile); } catch(SecurityException se) { diff --git a/tcdcommons-3-fabric-1.20.2/src/main/resources/assets/tcdcommons/icon.png b/tcdcommons-3-fabric-1.20.2/src/main/resources/assets/tcdcommons/icon.png index 88d8bc27..99cb3a84 100644 Binary files a/tcdcommons-3-fabric-1.20.2/src/main/resources/assets/tcdcommons/icon.png and b/tcdcommons-3-fabric-1.20.2/src/main/resources/assets/tcdcommons/icon.png differ diff --git a/tcdcommons-3-fabric-1.20.2/src/main/resources/fabric.mod.json b/tcdcommons-3-fabric-1.20.2/src/main/resources/fabric.mod.json index dbcea779..a73287b6 100644 --- a/tcdcommons-3-fabric-1.20.2/src/main/resources/fabric.mod.json +++ b/tcdcommons-3-fabric-1.20.2/src/main/resources/fabric.mod.json @@ -49,7 +49,6 @@ { "modmenu.curseforge": "${project.modmenu_link_curseforge}", "modmenu.modrinth": "${project.modmenu_link_modrinth}", - "modmenu.kofi": "${project.modmenu_link_kofi}", "modmenu.youtube": "${project.modmenu_link_youtube}" } } diff --git a/tcdcommons-3-fabric-1.20.4/gradle.properties b/tcdcommons-3-fabric-1.20.4/gradle.properties index bc1ac209..855643bf 100644 --- a/tcdcommons-3-fabric-1.20.4/gradle.properties +++ b/tcdcommons-3-fabric-1.20.4/gradle.properties @@ -27,7 +27,6 @@ org.gradle.jvmargs=-Xmx1G modmenu_link_curseforge = https://www.curseforge.com/projects/711539 modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 - modmenu_link_kofi = https://ko-fi.com/TheCSDev modmenu_link_youtube = https://www.youtube.com/@TheCSDev mod_license = LGPL-3.0-or-later diff --git a/tcdcommons-3-fabric-1.20.4/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java b/tcdcommons-3-fabric-1.20.4/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java index 876889aa..5d713e12 100644 --- a/tcdcommons-3-fabric-1.20.4/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java +++ b/tcdcommons-3-fabric-1.20.4/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java @@ -83,17 +83,22 @@ currPath.toFile() : currPath.getParent().toFile(); + final @Nullable var childDirectories = currFile.listFiles(File::isDirectory); + final @Nullable var childFiles = currFile.listFiles(File::isFile); + if(childDirectories == null || childFiles == null) + throw new SecurityException("Access denied."); + //add a "go back" list entry, allowing the user to navigate to the previous folder final var currFileParent = currFile.getParentFile(); if(currFileParent != null) addGoBackFileListItem(currFileParent); //iterate all child directories, and list them - for(final File childDir : currFile.listFiles(File::isDirectory)) + for(final File childDir : childDirectories) addFileListItem(childDir); //iterate all child non-directory files, and list them - for(final File childDir : currFile.listFiles(File::isFile)) - addFileListItem(childDir); + for(final File childFile : childFiles) + addFileListItem(childFile); } catch(SecurityException se) { diff --git a/tcdcommons-3-fabric-1.20.4/src/main/resources/assets/tcdcommons/icon.png b/tcdcommons-3-fabric-1.20.4/src/main/resources/assets/tcdcommons/icon.png index 88d8bc27..99cb3a84 100644 Binary files a/tcdcommons-3-fabric-1.20.4/src/main/resources/assets/tcdcommons/icon.png and b/tcdcommons-3-fabric-1.20.4/src/main/resources/assets/tcdcommons/icon.png differ diff --git a/tcdcommons-3-fabric-1.20.4/src/main/resources/fabric.mod.json b/tcdcommons-3-fabric-1.20.4/src/main/resources/fabric.mod.json index dbcea779..a73287b6 100644 --- a/tcdcommons-3-fabric-1.20.4/src/main/resources/fabric.mod.json +++ b/tcdcommons-3-fabric-1.20.4/src/main/resources/fabric.mod.json @@ -49,7 +49,6 @@ { "modmenu.curseforge": "${project.modmenu_link_curseforge}", "modmenu.modrinth": "${project.modmenu_link_modrinth}", - "modmenu.kofi": "${project.modmenu_link_kofi}", "modmenu.youtube": "${project.modmenu_link_youtube}" } } diff --git a/tcdcommons-3-fabric-1.20.5/buildsc.resources.gradle b/tcdcommons-3-fabric-1.20.5/buildsc.resources.gradle index d772f9d5..d4367762 100644 --- a/tcdcommons-3-fabric-1.20.5/buildsc.resources.gradle +++ b/tcdcommons-3-fabric-1.20.5/buildsc.resources.gradle @@ -18,7 +18,7 @@ do //obtain all jar files in `jarjar`, and construct a String for the `jars` entry in `fabric.mod.json`. //due to a bug in the compiler, this uses a cheesy workaround that injects json code into a json string def fmj_jars = new ArrayList(); - fileTree(dir: rssDirPath.resolve("/src/main/resources/META-INF/jarjar").toString(), include: '*.jar') + fileTree(dir: rssDirPath.resolve("META-INF/jarjar").toString(), include: '*.jar') .each { jarFile -> fmj_jars.add(rssDirPath.relativize(jarFile.toPath()).toString().replace('\\', '/')) }; fmj_jars = fmj_jars.collect { jarFile -> "{ \"file\": \"${jarFile}\" }" }; fmj_jars = "\", \"jars\": [" + fmj_jars.join(', ') + "], \"\": \""; diff --git a/tcdcommons-3-fabric-1.20.5/gradle.properties b/tcdcommons-3-fabric-1.20.5/gradle.properties index 44ceb972..f3e6b5d0 100644 --- a/tcdcommons-3-fabric-1.20.5/gradle.properties +++ b/tcdcommons-3-fabric-1.20.5/gradle.properties @@ -38,7 +38,6 @@ org.gradle.jvmargs=-Xmx1G modmenu_link_curseforge = https://www.curseforge.com/projects/711539 modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 - modmenu_link_kofi = https://ko-fi.com/TheCSDev modmenu_link_youtube = https://www.youtube.com/@TheCSDev # The name of the license that applies to this project. diff --git a/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java b/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java index 876889aa..5d713e12 100644 --- a/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java +++ b/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/client/gui/panel/explorer/FileListPanel.java @@ -83,17 +83,22 @@ currPath.toFile() : currPath.getParent().toFile(); + final @Nullable var childDirectories = currFile.listFiles(File::isDirectory); + final @Nullable var childFiles = currFile.listFiles(File::isFile); + if(childDirectories == null || childFiles == null) + throw new SecurityException("Access denied."); + //add a "go back" list entry, allowing the user to navigate to the previous folder final var currFileParent = currFile.getParentFile(); if(currFileParent != null) addGoBackFileListItem(currFileParent); //iterate all child directories, and list them - for(final File childDir : currFile.listFiles(File::isDirectory)) + for(final File childDir : childDirectories) addFileListItem(childDir); //iterate all child non-directory files, and list them - for(final File childDir : currFile.listFiles(File::isFile)) - addFileListItem(childDir); + for(final File childFile : childFiles) + addFileListItem(childFile); } catch(SecurityException se) { diff --git a/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/network/CustomPayloadNetwork.java b/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/network/CustomPayloadNetwork.java index 657e4767..24f35311 100644 --- a/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/network/CustomPayloadNetwork.java +++ b/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/network/CustomPayloadNetwork.java @@ -76,12 +76,12 @@ private CustomPayloadNetwork() {} public static boolean unregisterReceiver(NetworkSide side, Identifier packetId) { Objects.requireNonNull(packetId); - switch(Objects.requireNonNull(side)) + return switch (Objects.requireNonNull(side)) { - case SERVERBOUND: return (C2S.remove(packetId) != null); - case CLIENTBOUND: return (S2C.remove(packetId) != null); - default: return false; - } + case SERVERBOUND -> (C2S.remove(packetId) != null); + case CLIENTBOUND -> (S2C.remove(packetId) != null); + default -> false; + }; } // -------------------------------------------------- /** diff --git a/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/network/TCustomPayload.java b/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/network/TCustomPayload.java index 9df73974..63950a91 100644 --- a/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/network/TCustomPayload.java +++ b/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/api/network/TCustomPayload.java @@ -2,12 +2,14 @@ import io.github.thecsdev.tcdcommons.TCDCommons; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import net.minecraft.network.PacketByteBuf; import net.minecraft.network.codec.PacketCodec; import net.minecraft.network.packet.CustomPayload; import net.minecraft.util.Identifier; import org.jetbrains.annotations.ApiStatus; +import java.util.List; import java.util.Objects; import static io.github.thecsdev.tcdcommons.api.network.CustomPayloadNetwork.CPN_PACKET_ID; @@ -21,26 +23,27 @@ public final class TCustomPayload implements CustomPayload { // ================================================== public static final Id ID = new Id<>(CPN_PACKET_ID); - public static final PacketCodec CODEC = - PacketCodec.of(TCustomPayload::encode, TCustomPayload::decode); + public static final PacketCodec CODEC; // -------------------------------------------------- private final Identifier packetId; private final ByteBuf packetPayload; // ================================================== + static + { + CODEC = PacketCodec.of(TCustomPayload::encode, TCustomPayload::decode); + } + // -------------------------------------------------- public TCustomPayload(Identifier packetId, ByteBuf packetPayload) { this.packetId = Objects.requireNonNull(packetId); this.packetPayload = Objects.requireNonNull(packetPayload); } - // -------------------------------------------------- + // ================================================== public final @Override Id getId() { return ID; } // -------------------------------------------------- @SuppressWarnings("removal") protected final @Override void finalize() throws Throwable { - //finialize super - super.finalize(); - //finalize this try { @@ -49,6 +52,7 @@ public TCustomPayload(Identifier packetId, ByteBuf packetPayload) this.packetPayload.release(); } catch (Exception e) {} + finally { super.finalize(); } //finialize super } // ================================================== public final Identifier getPacketId() { return this.packetId; } @@ -82,7 +86,11 @@ private static void encode(TCustomPayload value, PacketByteBuf buffer) */ private static TCustomPayload decode(PacketByteBuf buffer) { - return null; + final var packetId = buffer.readIdentifier(); + final var packetDataLen = buffer.readIntLE(); + final var packetDataBytes = new byte[packetDataLen]; + buffer.readBytes(packetDataBytes); + return new TCustomPayload(packetId, Unpooled.wrappedBuffer(packetDataBytes)); } // ================================================== } \ No newline at end of file diff --git a/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/network/TCDCommonsNetworkHandler.java b/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/network/TCDCommonsNetworkHandler.java index 38490a90..ceb7ecdd 100644 --- a/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/network/TCDCommonsNetworkHandler.java +++ b/tcdcommons-3-fabric-1.20.5/src/main/java/io/github/thecsdev/tcdcommons/network/TCDCommonsNetworkHandler.java @@ -22,7 +22,6 @@ public final class TCDCommonsNetworkHandler extends Object { - // ================================================== /** * The unique {@link Identifier} of the {@link CustomPayloadS2CPacket} @@ -41,7 +40,7 @@ private TCDCommonsNetworkHandler() {} PayloadTypeRegistry.playS2C().register(TCustomPayload.ID, TCustomPayload.CODEC); //obtain CPN packet ID - final var cpnPacketId = AccessorCustomPayloadNetwork.getCpnPacketId(); + //final var cpnPacketId = AccessorCustomPayloadNetwork.getCpnPacketId(); final var c2s = AccessorCustomPayloadNetwork.getC2S(); final var s2c = AccessorCustomPayloadNetwork.getS2C(); diff --git a/tcdcommons-3-fabric-1.20.5/src/main/resources/assets/tcdcommons/icon.aseprite b/tcdcommons-3-fabric-1.20.5/src/main/resources/assets/tcdcommons/icon.aseprite new file mode 100644 index 00000000..3aebd3da Binary files /dev/null and b/tcdcommons-3-fabric-1.20.5/src/main/resources/assets/tcdcommons/icon.aseprite differ diff --git a/tcdcommons-3-fabric-1.20.5/src/main/resources/assets/tcdcommons/icon.png b/tcdcommons-3-fabric-1.20.5/src/main/resources/assets/tcdcommons/icon.png index 88d8bc27..99cb3a84 100644 Binary files a/tcdcommons-3-fabric-1.20.5/src/main/resources/assets/tcdcommons/icon.png and b/tcdcommons-3-fabric-1.20.5/src/main/resources/assets/tcdcommons/icon.png differ diff --git a/tcdcommons-3-fabric-1.20.5/src/main/resources/fabric.mod.json b/tcdcommons-3-fabric-1.20.5/src/main/resources/fabric.mod.json index feb41257..f66daf43 100644 --- a/tcdcommons-3-fabric-1.20.5/src/main/resources/fabric.mod.json +++ b/tcdcommons-3-fabric-1.20.5/src/main/resources/fabric.mod.json @@ -31,7 +31,8 @@ { "fabricloader": ">=${project.properties.loader_version}", "minecraft": "${project.properties.mod_depends_minecraft}", - "java": ">=17" + "java": ">=17", + "fabric-api": "*" }, "custom": @@ -43,7 +44,6 @@ { "modmenu.curseforge": "${project.properties.modmenu_link_curseforge}", "modmenu.modrinth": "${project.properties.modmenu_link_modrinth}", - "modmenu.kofi": "${project.properties.modmenu_link_kofi}", "modmenu.youtube": "${project.properties.modmenu_link_youtube}" } }