Oneil Wilson

"Create a Fabric mod for Minecraft 26.2 titled 'Return By Death'. When a player dies, cancel standard item drops, play a custom audio event named 'return_by_death', apply a 5-second Darkness and Blindness status effect, restore the player's previous inventory and XP, and teleport them back to their last saved checkpoint. Additionally, add a chat event listener: if a player types 'return by death', 'rbd', or 'satella' in chat, block the message, apply Darkness V, Slowness V, and deal 1000 magic damage to kill the player instantly."

Kodari AI
KodariSep 18 at 4:19 pm 6
ReturnByDeath
ReturnByDeath is a Fabric mod for Minecraft 26.2 that transforms death into a narrative mechanic. When a player dies, standard item drops are canceled, a custom audio event named 'return_by_death' plays, and the player receives 5 seconds of Darkness and Blindness. The mod restores the player's previous inventory and XP, then teleports them to their last saved checkpoint. Additionally, a chat listener intercepts the phrases 'return by death', 'rbd', or 'satella', blocking the message and punishing the speaker with Darkness V, Slowness V, and 1000 magic damage, enforcing the mod's thematic rules.
  1. Core mod setup and registrations

  2. Death interception with inventory/XP snapshot restoration, effects, sound, and checkpoint teleport

  3. Chat trigger handling for the three phrases and lethal magic damage

  4. Fabric metadata and sound resources

[Generation stopped]

Oneil Wilson

Create a Fabric mod for Minecraft 26.2 titled 'Return By Death'. When a player dies, cancel standard item drops, play a custom audio event named 'return_by_death', apply a 5-second Darkness and Blindness status effect, restore the player's previous inventory and XP, and teleport them back to their last saved checkpoint. Additionally, add a chat event listener: if a player types 'return by death', 'rbd', or 'satella' in chat, block the message, apply Darkness V, Slowness V, and deal 1000 magic damage to kill the player instantly.

Kodari AI
KodariSep 18 at 4:28 pm 9
  1. Inspect the existing Fabric project and preserve its generated structure.

  2. Add the shared Return By Death state, death handling, checkpoint tracking, and sound registration.

  3. Add the chat-trigger punishment listener and resource metadata.

  4. Run the project verifier and fix any 26.2 API issues it reports.

The initial implementation is in place. One source-verified access issue remains: ServerPlayer.server is private, so checkpoint lookup must go through ServerLevel.getServer().Implemented the Return By Death Fabric 26.2 mod.

  • Cancels player death item and XP drops through a LivingEntity mixin.

  • Restores inventory and XP after death.

  • Applies 5 seconds of Darkness and Blindness.

  • Plays the registered return_by_death sound event.

  • Teleports the player to their saved respawn checkpoint, including cross-dimension checkpoints.

  • Blocks chat messages matching:

    • return by death

    • rbd

    • satella

  • Applies Darkness V and Slowness V, then deals 1000 magic damage.

  • Added Fabric metadata, mixin configuration, sound registration, subtitle localization, and Gradle setup.

The custom sound event currently uses Minecraft’s built-in toast sound as an audible fallback because no custom .ogg file was provided.

Oneil Wilson

now how do i use it

Kodari AI
KodariSep 18 at 4:35 pm 1

How to use Return By Death

  1. Install Fabric Loader 0.19.3+ for Minecraft 26.2.

  2. Place the compiled mod .jar into your Minecraft mods folder.

  3. Install the required Fabric API 0.158.0+26.2.

  4. Start the game or server.

Normal death behavior

  1. Set a checkpoint by using a bed or respawn anchor.

  2. Keep the inventory and XP you want restored.

  3. Die normally.

  4. The mod will:

    • Prevent normal item and XP drops.

    • Play the return_by_death sound event.

    • Apply Darkness and Blindness for 5 seconds.

    • Restore your previous inventory and XP.

    • Return you to your saved checkpoint.

Chat punishment

Type one of these phrases in chat:

  • return by death

  • rbd

  • satella

The message will be blocked, and the player who typed it will receive Darkness V, Slowness V, and lethal magic damage.

The sound event is registered under return_by_death. Since no custom audio file was provided, the current implementation uses an existing Minecraft sound as a fallback rather than a unique audio clip.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
9 237
src/main/java/com/kodari/returnbydeath/ReturnByDeath.java
package com.kodari.returnbydeath;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.storage.LevelData;

public class ReturnByDeath implements ModInitializer {
    public static final String MOD_ID = "return_by_death";
    public static final Identifier RETURN_BY_DEATH_ID = Identifier.fromNamespaceAndPath(MOD_ID, "return_by_death");
    public static final SoundEvent RETURN_BY_DEATH = SoundEvent.createVariableRangeEvent(RETURN_BY_DEATH_ID);

    @Override
    public void onInitialize() {
        Registry.register(BuiltInRegistries.SOUND_EVENT, RETURN_BY_DEATH_ID, RETURN_BY_DEATH);

        ServerPlayerEvents.COPY_FROM.register((oldPlayer, newPlayer, alive) -> {
            if (alive) {
                return;
            }

            newPlayer.getInventory().replaceWith(oldPlayer.getInventory());
            newPlayer.experienceLevel = oldPlayer.experienceLevel;
            newPlayer.totalExperience = oldPlayer.totalExperience;
            newPlayer.experienceProgress = oldPlayer.experienceProgress;

            newPlayer.addEffect(new MobEffectInstance(MobEffects.DARKNESS, 100, 0));
            newPlayer.addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 100, 0));
            playReturnByDeathSound(newPlayer);
            teleportToCheckpoint(oldPlayer, newPlayer);
        });

        ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, boundChatType) -> {
            if (!isReturnByDeathPhrase(message)) {
                return true;
            }

            sender.addEffect(new MobEffectInstance(MobEffects.DARKNESS, 100, 4));
            sender.addEffect(new MobEffectInstance(MobEffects.SLOWNESS, 100, 4));
            if (sender.level() instanceof ServerLevel level) {
                sender.hurt(level.damageSources().magic(), 1000.0F);
            }
            return false;
        });
    }

    private static boolean isReturnByDeathPhrase(final PlayerChatMessage message) {
        String content = message.signedContent().trim().toLowerCase(java.util.Locale.ROOT);
        return content.equals("return by death") || content.equals("rbd") || content.equals("satella");
    }

    private static void playReturnByDeathSound(final ServerPlayer player) {
        Holder<SoundEvent> holder = BuiltInRegistries.SOUND_EVENT.wrapAsHolder(RETURN_BY_DEATH);
        player.connection.send(new ClientboundSoundEntityPacket(
            holder,
            SoundSource.PLAYERS,
            player,
            1.0F,
            1.0F,
            player.getRandom().nextLong()
        ));
    }

    private static void teleportToCheckpoint(final ServerPlayer oldPlayer, final ServerPlayer newPlayer) {
        ServerPlayer.RespawnConfig config = oldPlayer.getRespawnConfig();
        if (config == null) {
            return;
        }

        LevelData.RespawnData respawnData = config.respawnData();
        ServerLevel checkpointLevel = newPlayer.level().getServer().getLevel(respawnData.dimension());
        if (checkpointLevel == null) {
            return;
        }

        newPlayer.teleportTo(
            checkpointLevel,
            respawnData.pos().getX() + 0.5D,
            respawnData.pos().getY(),
            respawnData.pos().getZ() + 0.5D,
            java.util.Set.of(),
            respawnData.yaw(),
            respawnData.pitch(),
            true
        );
    }
}