make a minecraft fabric 1.21.11 mod that sends message/command only if i pop my totem and don't have any more totems in my inventory. The commands should be this. 1 - "/team sethome" 2 - "/team warp trap kasun123" I made this mod before with kodari ai but there were some problems. The mod works but you need to fix these. The mod sometimes doesn't run those commnds when I pop my totem even if there aren't any totems in my inventory. And also can you add a debug in chat that shows how many totems I have left when I pop a totem. It should be called "TotemCount" and it should only be shown to me in chat. Not to other player. Make it colorfull. (Not just one color)
Create the Fabric 1.21.11 project and split common/client source sets.
Hook successful client-side totem consumption, delay one tick, and count remaining totems after the consumed stack updates.
Show a private multicolor
TotemCountchat message and send both commands only when the count is zero.
Created a Fabric 1.21.11 mod with Yarn mappings and split client/common source sets.
Detects the local player’s successful totem-pop status, waits for inventory synchronization, and counts remaining totems.
Sends a private multicolor chat message such as
TotemCount | 0.When no totems remain, sends:
/team sethome/team warp trap kasun123
The project files have been created.
The compilation failed with this error:
Compilation failed with 2 error(s):
ERROR in src/main/java/client/java/com/kodari/totemcommands/mixin/LivingEntityMixin.java at line 15: incomparable types: LivingEntityMixin and ClientPlayerEntity
if (status == 35 && this == MinecraftClient.getInstance().player) {
^
ERROR in src/main/java/client/java/com/kodari/totemcommands/mixin/LivingEntityMixin.java at line 15: incomparable types: LivingEntityMixin and ClientPlayerEntity
if (status == 35 && this == MinecraftClient.getInstance().player) {
^
=== COMPILATION ERROR ANALYSIS ===
FILES TO INVESTIGATE:
- src/main/java/client/java/com/kodari/totemcommands/mixin/LivingEntityMixin.java
- src/main/java/client/java/com/kodari/totemcommands/mixin/LivingEntityMixin.java
Please fix this error by creating a new artifact with the corrected code.
Fixed the compilation error by casting the mixin instance to Object before comparing it with MinecraftClient.getInstance().player.
The corrected condition is:
if (status == 35 && (Object) this == MinecraftClient.getInstance().player) {
New artifact created with the corrected LivingEntityMixin.java.
Now build it
I can’t run the Gradle build directly in this environment because build tools are unavailable. The corrected code is already applied; the project will be compiled by the platform’s automatic verifier when the artifact is downloaded or submitted.
Now make the mod
Replace the single delayed check with a retry window so inventory synchronization delays cannot suppress the commands.
Keep the debug message private and colorful, reporting the observed count and any corrected zero count.
Use the named vanilla totem status constant and preserve client-only mixin loading.
The mod is now created and updated.
Reliably waits and retries inventory checks after a totem pop.
Displays a private colorful
TotemCountmessage.Executes the commands only when the remaining totem count reaches zero:
/team sethome/team warp trap kasun123
Uses the proper
EntityStatuses.USE_TOTEMconstant.Keeps the mixin client-only to avoid dedicated-server crashes.
Can I download the mod?
Not yet as a ready-to-install .jar. The project source has been created, but this environment hasn’t produced a compiled mod file.
To build it locally:
./gradlew build
On Windows:
gradlew.bat build
The compiled mod will be located at:
build/libs/totemcommands-*.jar
Place that JAR in your Minecraft instance’s mods folder along with Fabric API for Minecraft 1.21.11.
You can do that
I can prepare the mod project, but this environment does not provide Gradle, Java, or a build/artifact tool, so I can’t generate a downloadable .jar here.
Build it locally with:
./gradlew build
Then use:
build/libs/totemcommands-*.jar
Install that JAR in your Minecraft 1.21.11 mods folder with Fabric API.
package com.kodari.totemcommands;
import net.fabricmc.api.ClientModInitializer;
public class TotemCommandsClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
TotemCommandHandler.initialize();
}
}