Skip to content

Commit

Permalink
Release v3.9.7+fabric
Browse files Browse the repository at this point in the history
File explorer crash fix for Java 21, general tweaks and bug fixes, and port to 1.20.5.
  • Loading branch information
TheCSDev committed Apr 25, 2024
1 parent 86ca1d2 commit 4f432c2
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 36 deletions.
1 change: 0 additions & 1 deletion tcdcommons-3-fabric-1.20.1/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
}
Expand Down
1 change: 0 additions & 1 deletion tcdcommons-3-fabric-1.20.2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
}
Expand Down
1 change: 0 additions & 1 deletion tcdcommons-3-fabric-1.20.4/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
}
Expand Down
2 changes: 1 addition & 1 deletion tcdcommons-3-fabric-1.20.5/buildsc.resources.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>();
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(', ') + "], \"\": \"";
Expand Down
1 change: 0 additions & 1 deletion tcdcommons-3-fabric-1.20.5/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
}
// --------------------------------------------------
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,26 +23,27 @@ public final class TCustomPayload implements CustomPayload
{
// ==================================================
public static final Id<TCustomPayload> ID = new Id<>(CPN_PACKET_ID);
public static final PacketCodec<PacketByteBuf, TCustomPayload> CODEC =
PacketCodec.of(TCustomPayload::encode, TCustomPayload::decode);
public static final PacketCodec<PacketByteBuf, TCustomPayload> 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<? extends CustomPayload> getId() { return ID; }
// --------------------------------------------------
@SuppressWarnings("removal")
protected final @Override void finalize() throws Throwable
{
//finialize super
super.finalize();

//finalize this
try
{
Expand All @@ -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; }
Expand Down Expand Up @@ -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));
}
// ==================================================
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

public final class TCDCommonsNetworkHandler extends Object
{

// ==================================================
/**
* The unique {@link Identifier} of the {@link CustomPayloadS2CPacket}
Expand All @@ -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();

Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tcdcommons-3-fabric-1.20.5/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
{
"fabricloader": ">=${project.properties.loader_version}",
"minecraft": "${project.properties.mod_depends_minecraft}",
"java": ">=17"
"java": ">=17",
"fabric-api": "*"
},

"custom":
Expand All @@ -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}"
}
}
Expand Down

0 comments on commit 4f432c2

Please sign in to comment.