Skip to content

Commit ac3a8a1

Browse files
committed
initial commit
1 parent 00b9254 commit ac3a8a1

File tree

7 files changed

+65
-209
lines changed

7 files changed

+65
-209
lines changed

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ loader_version_range=[4,)
2626

2727
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
2828
# Must match the String constant located in the main mod class annotated with @Mod.
29-
mod_id=examplemod
29+
mod_id=tmwya
3030
# The human-readable display name for the mod.
31-
mod_name=Example Mod
31+
mod_name=TellMeWhoYouAre
3232
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
33-
mod_license=All Rights Reserved
33+
mod_license=MIT
3434
# The mod version. See https://semver.org/
3535
mod_version=1.0.0
3636
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
3737
# This should match the base package used for the mod sources.
3838
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
39-
mod_group_id=com.example.examplemod
39+
mod_group_id=com.github.argon4w.tmwya
4040
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
41-
mod_authors=YourNameHere, OtherNameHere
41+
mod_authors=Argon4W
4242
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
43-
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
43+
mod_description=A Minecraft Mod that provides detailed information when a CustomPayloadPacket crashes the network.

src/main/java/com/example/examplemod/Config.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/main/java/com/example/examplemod/ExampleMod.java

Lines changed: 0 additions & 136 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.github.argon4w.tmwya;
2+
3+
import com.mojang.logging.LogUtils;
4+
import net.neoforged.bus.api.IEventBus;
5+
import net.neoforged.fml.ModContainer;
6+
import net.neoforged.fml.common.Mod;
7+
import org.slf4j.Logger;
8+
9+
@Mod(ExampleMod.MODID)
10+
public class ExampleMod {
11+
12+
public static final String MODID = "tmwya";
13+
private static final Logger LOGGER = LogUtils.getLogger();
14+
15+
public ExampleMod(IEventBus modEventBus, ModContainer modContainer) {
16+
17+
}
18+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.github.argon4w.tmwya.mixins;
2+
3+
import com.llamalad7.mixinextras.sugar.Local;
4+
import io.netty.buffer.ByteBuf;
5+
import net.minecraft.network.PacketDecoder;
6+
import net.minecraft.network.protocol.Packet;
7+
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
8+
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.ModifyArg;
12+
13+
@Mixin(PacketDecoder.class)
14+
public class PacketDecoderMixin {
15+
@ModifyArg(method = "decode", at = @At(value = "INVOKE", target = "Ljava/io/IOException;<init>(Ljava/lang/String;)V"))
16+
public String provideDetailedMessageForCustomPayload(String message, @Local(index = 5, name = "packet") Packet<?> packet, @Local(index = 2, name = "in", argsOnly = true) ByteBuf in) {
17+
18+
if (packet instanceof ClientboundCustomPayloadPacket(CustomPacketPayload payload)) {
19+
return "CustomPayloadPacket \"%s\" was larger than I expected, found %d bytes extra whilst reading packet.".formatted(payload.type().id(), in.readableBytes());
20+
}
21+
22+
return message;
23+
}
24+
}

src/main/resources/META-INF/neoforge.mods.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ loaderVersion="${loader_version_range}" #mandatory
1414
license="${mod_license}"
1515

1616
# A URL to refer people to when problems occur with this mod
17-
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
17+
issueTrackerURL="https://github.com/Argon4W/TMWYA/issues" #optional
1818

1919
# A list of mods - how many allowed here is determined by the individual mod loader
2020
[[mods]] #mandatory
@@ -32,7 +32,7 @@ displayName="${mod_name}" #mandatory
3232
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
3333

3434
# A URL for the "homepage" for this mod, displayed in the mod UI
35-
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
35+
displayURL="https://github.com/Argon4W/TMWYA" #optional
3636

3737
# A file name (in the root of the mod JAR) containing a logo for display
3838
#logoFile="examplemod.png" #optional
@@ -47,8 +47,8 @@ authors="${mod_authors}" #optional
4747
description='''${mod_description}'''
4848

4949
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
50-
#[[mixins]]
51-
#config="${mod_id}.mixins.json"
50+
[[mixins]]
51+
config="${mod_id}.mixins.json"
5252

5353
# The [[accessTransformers]] block allows you to declare where your AT file is.
5454
# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg

src/main/resources/tmwya.mixins.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"required": true,
3+
"minVersion": "0.8",
4+
"package": "com.github.argon4w.tmwya.mixins",
5+
"compatibilityLevel": "JAVA_21",
6+
"refmap": "mixins.everyxhotpot.refmap.json",
7+
"client": [
8+
"PacketDecoderMixin"
9+
],
10+
"injectors": {
11+
"defaultRequire": 1
12+
}
13+
}

0 commit comments

Comments
 (0)