BTD 6
📎 1 file 2,739 chars
📄
pasted-code-1794937684908.txt
txt 39 lines
▶
Create a Minecraft Java Edition Fabric mod for version 1.21.11 (Fabric Loader + Fabric API, Yarn mappings) that adds a single command:

/ntp   

Behavior when run by a player:

    Clear the space in front of the player, then build a nether portal there.

        Determine the portal footprint: a standard 4×5 obsidian frame (2×3 interior) placed 2 blocks in front of the player, oriented perpendicular to the player's horizontal facing (portal axis set correctly based on facing).

        Destroy/remove every block occupying the portal footprint and its interior (the 4×5 frame volume) before building. This includes any block type — stone, dirt, water, lava, existing portal blocks, etc. Do not skip or refuse because of obstruction; the command's contract is "clear and build."

        Optionally leave a 1-block air buffer above/around the frame so the portal is enterable. State explicitly in the code comments what volume is cleared.

        If the target volume is outside world bounds (Y < world min or Y > world max) or in an unloaded chunk, fail gracefully with an error message and place nothing.

    Build a matching nether portal at the exact coordinates    given in the command (the destination portal).

        Apply the same clear-then-build rule at the destination: remove all blocks in the destination portal footprint and interior before placing the frame and portal blocks.

        Same world-bounds / unloaded-chunk validation; fail gracefully if invalid.

    Hard-link the two portals together, overriding vanilla nether portal linking. When a player enters the source portal they arrive at the destination portal, and vice versa. Do not rely on vanilla's 8:1 coordinate scaling or proximity search — maintain an explicit link map and intercept the portal teleport event.

Requirements:

    Command must work from both player and server console (console needs explicit coordinates; ~ ~ ~ resolves only for players).

    Support relative coordinates (~ ~ ~) via Vec3ArgumentType / BlockPosArgumentType + EntityAnchorArgumentType.

    Persist the link map across server restarts (JSON file or NBT in the world save).

    If a linked portal block is broken, remove the link entry.

    Do not silently overwrite blocks the player didn't intend to destroy — but per this spec, "in front of the player" and "at the given coordinates" are explicitly authorized destruction zones. Document the cleared volume in comments.

    Include: fabric.mod.json, build.gradle, any mixins needed, and the command registration class.

Deliverables: complete source code for all files, with comments explaining the clear-volume logic, portal placement, axis calculation, and the teleport interception hook.
Kodari AI
KodariTue at 5:57 pm 6
NetherPortalLinker
Adds a /ntp command that clears space and builds a nether portal in front of the player, then creates a matching portal at specified coordinates. Maintains a persistent hard-link map between portal pairs, overriding vanilla linking. Intercepts portal teleport events to route players between linked portals. Supports relative coordinates, console usage, and graceful failure on invalid locations.

The destination uses the command’s current dimension. For console use, I’ll add /ntp <x> <y> <z> <sourceX> <sourceY> <sourceZ> because a console has no position or facing.

Created the /ntp mod. Players use /ntp <x> <y> <z>; console uses /ntp <x> <y> <z> <sourceX> <sourceY> <sourceZ> with absolute coordinates. Both portals are built in the command’s current dimension.

Limitation: If a linked destination is unloaded when a player enters, the current implementation falls back to vanilla portal linking rather than preventing teleportation.

BTD 6
📎 1 file 2,258 chars
📄
pasted-code-1794938684123.txt
txt 27 lines
▶
    Entering a linked portal must not teleport the player instantly. Instead:

        Start a configurable delay (default 4 seconds / 80 ticks, matching vanilla nether portal wait time) when the player enters the portal.

        During the delay, keep the player in the portal (apply the vanilla-style portal overlay/screen effect if feasible). If the player leaves the portal before the delay ends, cancel the teleport.

        When the delay completes, perform the teleport to the linked destination portal.

        Apply a post-teleport cooldown (default 2 seconds) so the player isn't immediately pulled back through the destination portal. Track this per-player (e.g. an NBT tag or an in-memory map with expiry).

    The delay and cooldown values must be constants or config fields at the top of the class, clearly commented, so they're easy to tune.

Chunk loading for portal placement:

    The command must not fail just because the destination    is in an unloaded chunk. Instead:

        Resolve the destination BlockPos and the chunk(s) it touches. A portal is up to 4 blocks wide and 5 tall, so compute every chunk intersecting the cleared 4×5 volume (usually 1 chunk, but 2 if the frame straddles a chunk border).

        Force-load each of those chunks before clearing/building — e.g. world.getChunk(x, z, ChunkStatus.FULL, true) to generate/load, and hold a temporary ticket (world.getChunkManager().addTicket(...) with a short-lived TicketType) for the duration of placement so the chunk isn't unloaded mid-build.

        Place the frame and portal blocks after the chunks are loaded and confirmed non-null.

        Release the temporary tickets once placement is complete (do not leave permanent force-loads unless the link map entry requires it — and if the link map points into an unloaded chunk, either keep a ticket while the link exists or re-load on demand at teleport time; state which approach you chose in comments).

    Same rule applies to the source portal in front of the player (the player's own chunk is normally loaded, but validate anyway).

    If chunk generation is disabled or the position is outside world bounds, still fail gracefully with an error message — this is the only remaining failure case.
Kodari AI
KodariTue at 6:12 pm 5
  1. Add the portal delay and per-player cooldown, cancelling if the player leaves.

  2. Load portal chunks for placement and reload linked destinations on demand.

Added an 80-tick linked-portal delay and a 40-tick post-teleport cooldown. Leaving early cancels the wait; both values are constants at the top of PortalLinks.

Portal chunks are temporarily ticketed and loaded for placement. Linked destinations are reloaded on demand rather than permanently force-loaded; a load failure no longer falls back to vanilla linking.

BTD 6
📎 1 file 1,750 chars
📄
pasted-code-1794939610904.txt
txt 13 lines
▶
While the player is waiting through the 4-second / 80-tick delay inside the linked portal, the vanilla Nether portal overlay must render on their screen, exactly as it does when standing in a vanilla Nether portal. In Java Edition this is the Nether portal texture stretched across the entire screen .

Do not attempt to reimplement the overlay from scratch. Instead, drive the vanilla rendering path:

    The cleanest approach is to set the player's portal cooldown / portal timer field (the same field vanilla uses when a player stands in a NETHER_PORTAL block) while they are inside your linked portal. Vanilla's client-side renderer reads this value and draws the overlay automatically.

    If directly writing the portal timer field is unreliable across Yarn mappings for 1.21.11, the fallback is to send a custom S2C packet from the server to the specific player and have the client call the vanilla method that renders the portal overlay for the duration of the delay.

The overlay must fade in when the delay starts and disappear immediately if the player leaves the portal (cancelling the teleport). It must also not persist after the teleport completes or is cancelled.

Known vanilla quirk to handle: if the player has the Nausea effect, vanilla skips rendering the portal overlay entirely . Decide whether your mod should override this (render the overlay regardless) or mirror vanilla behavior; state the choice explicitly in comments. For a faithful "vanilla effect" feel, mirroring vanilla (skip overlay when Nauseous) is usually correct.

The overlay should only appear for players in Survival/Adventure mode or whenever vanilla would normally show it — check what vanilla does and match it, rather than hardcoding a gamemode check.
Kodari AI
KodariTue at 6:26 pm 5

I’ll keep vanilla’s overlay and its 1.21.11 rendering behavior, and clear its intensity when a linked-portal wait ends or is cancelled.

Linked portals now use vanilla’s portal overlay and fade-in. The overlay is cleared when the wait is cancelled or completes.

The mod mirrors Minecraft 1.21.11’s own Nausea and game-mode rendering behavior rather than overriding it. Clients need the mod installed for immediate overlay clearing.

BTD 6
📎 1 file 3,916 chars
📄
pasted-code-1794940755207.txt
txt 47 lines
▶
The vanilla portal overlay does not render during the custom teleport delay on Minecraft 1.21.11 Fabric. Fix it using the correct 1.21.11 mapping and rendering path. Do not repeat the previous approach of "writing the portal timer field" or "sending a custom packet to call the vanilla render method" — that approach does not work on 1.21.11. Follow these constraints:

1. Confirm mappings first.

    1.21.11 Fabric uses Mojang official mappings, not Yarn. Verify gradle.properties / build.gradle are set up for Mojang mappings (or the Fabric equivalent for 1.21.11). If the project still references Yarn names like InGameHud, MinecraftClient, or Entity.portalTime, update them to their Mojang-mapped equivalents before doing anything else. State the exact class and method names you are targeting for 1.21.11.

2. Use a client-side Mixin on the HUD renderer — not the server timer.

    Do not modify any server-side portal timer field. The server field is either moved or renamed in 1.21.11, and even if set, it will not reliably drive the client overlay.

    Instead, inject into the client's in-game HUD render method (the 1.21.11 Mojang-mapped equivalent of InGameHud.render). Use @Inject at the point where the portal overlay is drawn, or @Redirect on the overlay render call, and force the overlay to render when a client-side flag is true.

    If the overlay render method is private, use an @Invoker accessor mixin to call it, or replicate the call at the correct injection point. Do not reimplement the overlay shader/texture from scratch.

3. Handle the Nausea check explicitly.

    Vanilla skips rendering the portal overlay when the player has the Nausea (CONFUSION) effect. In your Mixin, decide and document whether to:

        (a) mirror vanilla — skip overlay when Nauseous, or

        (b) override — always render the overlay during the custom teleport delay.

    Recommended: mirror vanilla for a faithful effect. Implement it by placing your injection so it respects the same condition, or explicitly checking the effect in your handler.

4. Client-side state flag.

    The server must tell the client "this player is now waiting in a linked portal." Send a small custom S2C packet on portal-enter and a "stop" packet on cancel or teleport-complete. The client stores this in a boolean (or tick counter) that the Mixin reads.

    Do not rely on reading the player's portal state from the client world — your portal is a custom link, and the client cannot know the player is "in a linked portal" from block state alone.

    Clear the flag reliably on: teleport complete, player leaves the portal, player disconnects, and world change. State in comments where each clear happens.

5. Overlay lifetime.

    Overlay turns on when the delay starts, stays on for the full delay (default 80 ticks), and turns off immediately on cancel or teleport. No lingering overlay after teleport.

    If the player leaves the portal mid-delay and the teleport is cancelled, the "stop" packet must fire and the overlay must vanish on the same tick.

6. Verify against real 1.21.11 names.

    Before writing the Mixin, look up the actual 1.21.11 Mojang-mapped names for: the in-game HUD class, the portal overlay render method, and the Nausea effect check. Use mappings.dev or a decompiled 1.21.11 jar. List the exact target class + method + descriptor in a comment at the top of the Mixin so it's auditable.

7. Provide diagnostic output.

    If the Mixin fails to apply, the mod should log a clear warning at startup (e.g. "portal overlay mixin did not apply — check 1.21.11 mappings"). Do not fail silently.

Deliverables: the Mixin class(es), the packet classes (S2C start/stop), the client-side state holder, the server-side hook that sends the packets, and updated fabric.mod.json / build.gradle if mappings changed. Include comments stating the exact 1.21.11 target names and the Nausea decision.
Kodari AI
KodariTue at 6:47 pm 6

This project uses Yarn mappings, not Mojang mappings: 1.21.11+build.5 is configured in Gradle. I’ll target Yarn’s InGameHud.renderMiscOverlays and its vanilla renderPortalOverlay path; the 1.21.11 source also shows that portal overlay takes priority over the Nausea overlay.

Updated the client HUD mixin to drive vanilla’s portal overlay during linked-portal waits. Stop packets, disconnects, and world changes clear the linked-overlay state.

The project remains on Yarn mappings. Unlike the reported quirk, the 1.21.11 source prioritizes the portal overlay over the Nausea overlay, so the mixin preserves that behavior.

A missing injection causes a Mixin startup error rather than the requested custom warning. The change has not been tested in-game.

BTD 6
📎 1 file 2,486 chars
📄
pasted-code-1794941519556.txt
txt 31 lines
▶
Symptom: When the player enters a linked portal and waits through the teleport delay, no portal overlay appears on screen at all — no texture, no tint, nothing. The teleport itself works; only the visual effect is missing. There is no crash.

Context: Minecraft 1.21.11, Fabric. This is a follow-up to a previous fix attempt that did not work. Do not repeat any of these already-failed approaches:

    Writing a server-side portal timer field.

    Sending a custom packet that calls the vanilla overlay render method.

    Targeting Yarn-mapped names like InGameHud / Entity.portalTime.

What I need you to do:

    Diagnose before fixing. List the four realistic causes for "no overlay at all" on 1.21.11, and for each one, tell me the exact file or log line I should check to confirm or rule it out. The four causes to cover:

        (a) Mappings mismatch — project still on Yarn names while 1.21.11 requires Mojang mappings, so the Mixin never applies.

        (b) Mixin injection point wrong — target class/method/descriptor doesn't exist in 1.21.11, so the Mixin silently fails to apply.

        (c) Client flag never set — the S2C "start overlay" packet isn't arriving, isn't handled, or the flag is cleared immediately.

        (d) Nausea / vanilla condition suppressing it — the vanilla check skips the overlay and your code inherits that behavior.

    Give me a diagnostic checklist I can run without sending you files: which log lines to grep for, which Mixin warning to look for at startup, and one minimal test (e.g. "force the client flag to true at world join and see if the overlay appears") that isolates whether the problem is server-side (packet/flag) or client-side (Mixin/render).

    Then provide the fix using the correct 1.21.11 Mojang-mapped names. State the exact target class, method name, and descriptor you are injecting into, and where you got those names from (mappings.dev, decompiled jar, etc.). If the overlay render method is private, use an @Invoker accessor rather than reimplementing it.

    Handle the Nausea check explicitly — state whether you mirror vanilla (skip overlay when Nauseous) or override it, and implement that choice.

    Add a startup log line confirming whether the Mixin applied, so a silent failure is impossible next time.

Deliverables: the diagnostic checklist first, then the corrected Mixin class, packet classes, and client state holder. Comments must state the exact 1.21.11 target names and the Nausea decision.
Kodari AI
KodariTue at 6:56 pm 3

Diagnostic checklist

Check logs/latest.log on both the client and server. This mod must be installed on the client for its overlay code and packet receiver to run.

  1. Mappings: build.gradle:15 uses Yarn 1.21.11+build.5. Fabric 1.21.11 does not require Mojang mappings; Yarn is valid. A mappings mismatch is therefore not established as the cause.

  2. Mixin: Search the client log for ntp.client.mixins.json, InGameHudMixin, Mixin apply failed, and InjectionError. The config is declared in src/main/resources/fabric.mod.json and is marked "required": true, with defaultRequire: 1. A missing required injection should fail startup, not silently disable the overlay. There is currently no success log confirming it applied.

  3. Packet and flag: The server sends ntp:portal_wait from PortalManagerMixin; the client receives it in src/client/java/dev/kodari/ntp/NtpClient.java. Search for ntp and networking errors, but note that the current code does not log sends, receives, or canSend failures. On a dedicated server, make sure the client also has this mod installed. Temporarily forcing the client’s waiting flag to true after joining a world isolates the paths: an overlay points toward packet/state handling; no overlay points toward the client mixin/render path.

  4. Nausea: In the mounted 1.21.11 source, InGameHud.renderMiscOverlays gives a positive portal intensity priority over the Nausea overlay; Nausea does not suppress it in that path. Compare with and without Nausea, but this is unlikely to explain a completely absent overlay.

The verified Yarn targets are InGameHud.renderMiscOverlays(DrawContext, RenderTickCounter)V and the private InGameHud.renderPortalOverlay(DrawContext, float)V, from the mounted 1.21.11 source. I can’t provide a Mojang-mapped replacement in this Yarn-mapped project without changing its required mappings, and the cause of the missing overlay has not yet been established. No files were changed.

BTD 6

Does it have support for luckperms? If no, add permissions

Kodari AI
KodariTue at 7:26 pm 5

/ntp currently requires operator-level permission but has no LuckPerms node. I’ll add an optional ntp.use check, retaining the existing operator fallback.

Added optional LuckPerms support for /ntp with the permission ntp.use.

Grant it with /lp user <player> permission set ntp.use true. An explicit denial overrides operator status; if the node is unset or LuckPerms isn’t installed, the existing operator-level check applies. Console access remains unchanged.

BTD 6

The compilation failed with this error:

code
Compilation failed with 12 error(s):

ERROR in src/main/java/dev/kodari/ntp/NtpCommand.java at line 6: package net.luckperms.api does not exist
import net.luckperms.api.LuckPermsProvider;
                        ^

ERROR in src/main/java/dev/kodari/ntp/NtpCommand.java at line 7: package net.luckperms.api.model.user does not exist
import net.luckperms.api.model.user.User;
                                   ^

ERROR in src/main/java/dev/kodari/ntp/NtpCommand.java at line 8: package net.luckperms.api.util does not exist
import net.luckperms.api.util.Tristate;
                             ^

ERROR in src/main/java/dev/kodari/ntp/NtpCommand.java at line 41: cannot find symbol
        User user = LuckPermsProvider.get().getUserManager().getUser(player.getUuid());
        ^
  symbol: class User
  location: class NtpCommand

ERROR in src/main/java/dev/kodari/ntp/NtpCommand.java at line 43: cannot find symbol
        Tristate result = user.getCachedData().getPermissionData().checkPermission("ntp.use");
        ^
  symbol: class Tristate
  location: class NtpCommand

ERROR in src/main/java/dev/kodari/ntp/NtpCommand.java at line 44: cannot find symbol
        return result == Tristate.UNDEFINED ? fallback : result.asBoolean();
                         ^
  symbol: variable Tristate
  location: class NtpCommand

ERROR in   src/main/java/dev/kodari/ntp/NtpCommand.java at line 41: cannot find symbol
          User user = LuckPermsProvider.get().getUserManager().getUser(player.getUuid());
          ^
  symbol: class User
  location: class NtpCommand

ERROR in   src/main/java/dev/kodari/ntp/NtpCommand.java at line 43: cannot find symbol
          Tristate result = user.getCachedData().getPermissionData().checkPermission("ntp.use");
          ^
  symbol: class Tristate
  location: class NtpCommand

ERROR in   src/main/java/dev/kodari/ntp/NtpCommand.java at line 44: cannot find symbol
          return result == Tristate.UNDEFINED ? fallback : result.asBoolean();
                           ^
  symbol: variable Tristate
  location: class NtpCommand

ERROR in   src/main/java/dev/kodari/ntp/NtpCommand.java at line 6: package net.luckperms.api does not exist
  import net.luckperms.api.LuckPermsProvider;
                          ^

ERROR in   src/main/java/dev/kodari/ntp/NtpCommand.java at line 7: package net.luckperms.api.model.user does not exist
  import net.luckperms.api.model.user.User;
                                     ^

ERROR in   src/main/java/dev/kodari/ntp/NtpCommand.java at line 8: package net.luckperms.api.util does not exist
  import net.luckperms.api.util.Tristate;
                               ^


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - User
  - Tristate
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/dev/kodari/ntp/NtpCommand.java
  -   src/main/java/dev/kodari/ntp/NtpCommand.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariTue at 7:29 pm 2

The LuckPerms API isn’t reaching the compiler despite the declared dependency. I’ll make the integration optional at runtime, preserving ntp.use and the operator fallback.

Removed the compile-time LuckPerms dependency and retained optional runtime support for ntp.use. If LuckPerms is unavailable, /ntp falls back to operator permissions.

The patch is in place; compilation hasn’t been verified here.

BTD 6
📎 1 file 3,589 chars
📄
pasted-code-1795010399976.txt
txt 43 lines
▶
New feature: Extend the /ntp command so the destination can be a player name instead of coordinates. When a player name is given, the exit portal is built 2 blocks in front of that player (using that player's current facing), and the source and exit portals are hard-linked exactly as with the coordinate version.

Command syntax:

    /ntp    — existing behavior, unchanged.

    /ntp  — new: build the exit portal 2 blocks in front of .

    Use a single Commands.argument(...) with a custom ArgumentType that accepts either a Vec3/BlockPos or an EntityArgumentType.player(), so tab-completion offers both online player names and coordinate hints. Do not register two separate literal branches that shadow each other — resolve the argument type explicitly and document how you distinguish a player name from coordinates (e.g. try player lookup first, fall back to coordinate parse, or use a custom ArgumentType with its own parse method).

Behavior when the destination is a player:

    Resolve the target player by name on the server (must be online; if offline or not found, fail gracefully with a clear error — do not guess a UUID from a cache).

    Compute the exit portal position: 2 blocks in front of the target player, along the target player's horizontal facing, at the target player's Y level. Apply the same clear-then-build rule as the coordinate version — remove all blocks in the 4×5 portal footprint and 2×3 interior before placing the frame.

    Apply the same chunk-loading rule — force-load any chunks the exit portal footprint touches, hold a temporary ticket during placement, release after.

    Orient the exit portal perpendicular to the target player's facing, not the command sender's. The portal axis must be computed from the target player's facing.

    Validate the target player's space: if placing 2 blocks in front of them would put the portal inside the target player, or the target player is in a vehicle / flying / in a dimension where the portal can't exist, fail gracefully with a specific error rather than clipping the portal through them. State in comments what "2 blocks in front" means when the target is sneaking, swimming, or in a 1-block-high space.

    If the target player is the same player as the command sender, still allow it — the exit portal will be built in front of them, which is a valid use case. Do not add a self-target guard.

Error cases to handle explicitly (each with its own message, not a generic "failed"):

    Player name not found / not online.

    Target player is in a different dimension than the sender — decide and document whether the link is allowed across dimensions (and if so, how the link map keys the dimension) or rejected.

    Target player's "2 blocks in front" position is out of world bounds.

    Target player is in a chunk that cannot be loaded/generated.

Do not:

    Change the existing coordinate behavior.

    Rely on the sender's facing for the exit portal orientation.

    Silently pick a different position if the target's front is blocked — the clear-then-build rule already handles obstruction.

Deliverables: the updated command registration (showing how the dual argument type is parsed and how tab-completion behaves), the shared buildPortalAt(ServerWorld, BlockPos, Direction.Axis) helper used by both coordinate and player destinations, the player-resolution logic, and updated error messages. Comments must state how a player name is distinguished from coordinates and what "2 blocks in front" means in edge cases (sneaking, swimming, tight spaces).
Kodari AI
KodariWed at 2:07 pm 7

I’ll add a single destination argument for coordinates or an online player, with separate portal axes and the existing temporary chunk-loading behavior. Cross-dimension player targets will be rejected because the current link map stores one dimension per pair.

Added /ntp <player> for online players, with player-name and coordinate suggestions. The exit uses the target’s facing; cross-dimension targets are rejected.

Limitation: /ntp <your own name> with the implicit source is rejected because both requested portals occupy the same footprint. An explicit, non-overlapping source can be supplied instead: /ntp <player> <sourceX> <sourceY> <sourceZ>.

The changes have not been compiled or tested in-game.

BTD 6
📎 1 file 5,624 chars
📄
pasted-code-1795011837304.txt
txt 90 lines
▶
Rework the /ntp command so the enter portal and exit portal can each be specified as either a player or a set of coordinates, with an optional size. Replace the current single-destination command with the following syntax. Keep all previously agreed behavior (clear-then-build, chunk loading, hard-linking, teleport delay, vanilla portal overlay) unless this prompt overrides it.

Command syntax (all forms must be supported):
Form	Enter portal	Exit portal	Size
/ntp 	2 blocks in front of the sender	2 blocks in front of 	default
/ntp   	2 blocks in front of the sender	2 blocks in front of 	height × width
/ntp   	2 blocks in front of the sender	exactly at   	default
/ntp     	2 blocks in front of the sender	exactly at   	height × width
/ntp  	2 blocks in front of 	2 blocks in front of 	default
/ntp    	2 blocks in front of 	2 blocks in front of 	height × width
/ntp      	exactly at 	exactly at 	default
/ntp        	exactly at first coords	exactly at second coords	height × width

Parsing rules (this is the hard part — get it right):

    Use a single custom ArgumentType (e.g. PortalTargetArgumentType) that parses one "target" token: either a player name (online, resolved server-side) or a block position (~-relative allowed). Do not use two competing literal branches — they will shadow each other.

    The command then takes one or two targets, then optionally two integers (height, width). Disambiguate "second target" from "size" by argument count and type: if the next tokens are two integers, they are size; if they are a target, it's the exit endpoint; coordinates are detected by the presence of three numeric/~ tokens, a player by a string that resolves to an online player.

    Tab-completion must offer online player names for target positions, and nothing misleading for the size slots.

    If only one target is given (player or coords), the enter portal defaults to 2 blocks in front of the command sender and the exit portal goes to that one target. This is the backwards-compatible shorthand.

    If the sender is the console, "2 blocks in front of the sender" is undefined — fail gracefully with a clear message telling the operator to specify both endpoints explicitly.

Placement rules:

    "2 blocks in front" = 2 blocks along the entity's horizontal facing, at the entity's Y level. The portal axis is computed from that entity's facing, not the sender's. Document what "in front" means when the entity is sneaking, swimming, or in a 1-block-high space.

    Explicit coordinates = portal built exactly there, axis computed from the sender's facing (or a sensible default — state which).

    Both ends use the clear-then-build rule: remove every block in the portal footprint and interior before placing the frame and portal blocks.

    Both ends use the chunk-loading rule: force-load intersecting chunks, hold a temporary ticket during build, release after.

    If both endpoints resolve to the same position, fail with a clear error (a portal cannot link to itself).

Size rules:

    height = total frame height including the obsidian border (so default vanilla = 5).

    width = total frame width including the obsidian border (so default vanilla = 4).

    Minimums: height ≥ 3, width ≥ 2 (interior must be at least 1×1, i.e. a 3×2 frame). Reject smaller values with a clear error naming the minimums.

    Maximums: enforce a sane cap (e.g. height ≤ 32, width ≤ 32) to prevent accidental megabuilds or lag; state the cap in the error message.

    Both portals in a link must be the same size. If the user supplies one size, apply it to both. Do not support per-end sizes unless the user explicitly asks later — document this choice.

    The interior (non-obsidian) area is (height − 2) × (width − 2) and is filled with NETHER_PORTAL blocks with the correct axis.

    Default when size is omitted: 5 × 4 (vanilla).

Error cases (each with its own message):

    Player not found / not online (for either target).

    Console sender with only one target (ambiguous "in front of sender").

    Both endpoints identical.

    Size below minimum or above maximum.

    Target position out of world bounds.

    Chunk cannot be loaded/generated.

    Cross-dimension link: [allowed / rejected — pick one and state it].

Do not:

    Use the sender's facing for a player-target portal — always use that player's facing.

    Add a "can't target yourself" guard — self-targeting is allowed and means "exit portal in front of me."

    Silently relocate a portal if the front is blocked — the clear-then-build rule already handles it.

    Change the teleport-delay, overlay, or link-map behavior from the previous prompts.

Deliverables:

    The custom ArgumentType class with parse, getExamples, and a listSuggestions override for player-name tab-completion.

    The rewritten CommandRegistrationCallback showing how one vs. two targets vs. size are disambiguated.

    A shared helper buildPortalPair(ServerWorld, PortalEndpoint enter, PortalEndpoint exit, int height, int width) used by every syntax form, where PortalEndpoint is a small record holding either a resolved player or a BlockPos + Axis decision.

    Updated error messages.

    Comments stating: how targets are distinguished from size, what "2 blocks in front" means in edge cases, the min/max size and why, and the cross-dimension decision.
Kodari AI
KodariWed at 2:29 pm 8

I’ll keep links within one dimension and preserve existing saved links. One correction to the size rules: a frame width of 2 has no interior, so the minimum usable frame is 3 high × 3 wide.

Reworked /ntp to accept one or two player or coordinate endpoints, with an optional shared height and width. Existing saved links retain their default 5×4 size.

Cross-dimension links are rejected. The minimum frame is 3×3, not 3×2: a width of 2 leaves no portal interior. The maximum is 32×32.

The changes have not been compiled or tested in-game.

BTD 6
📎 1 file 3,709 chars
📄
pasted-code-1795016773341.txt
txt 63 lines
▶
Corrected requirement: This is a client-side mod with server-side components. It must NOT block vanilla clients from joining a server that has the server-side portion installed.

The previous instruction to "make it purely server-side and drop all client features" is cancelled. Instead, implement a soft-dependency model:

1. Server can run without forcing client installation.

    The server-side code (command registration, portal building, link map, teleport logic) must function even if a joining player has no client-side mod installed.

    A vanilla client must be able to join the server, run /ntp, see the portals appear, and teleport normally.

    The only thing a vanilla client loses is the custom client-side visual feedback (the portal overlay during the teleport delay). That is acceptable and must be documented.

2. Client-side features are optional enhancements.

    Keep the portal overlay implementation (Mixin on the HUD renderer, client-side state flag) for players who do have the mod installed.

    The server must detect whether a connecting client has the mod. If yes, send the overlay-triggering packet. If no, skip it silently—do not error, do not kick, do not log a warning per-join.

    Use Fabric's ServerPlayNetworking.canSend(player, packetId) (or the equivalent for your version) to check client capability before sending any custom S2C packet. If the client cannot receive it, bypass the send entirely.

3. Registry safety (critical for vanilla joins).

    Do not register any new blocks, items, entities, or other registry entries on the server that would desync a vanilla client's registry.

    The mod may place only existing vanilla blocks (OBSIDIAN, NETHER_PORTAL).

    If you need a custom packet for the overlay, use a Fabric CustomPayload / PacketType that is registered only on the client and is never part of the vanilla registry sync. If the client lacks it, the server simply never sends it.

4. fabric.mod.json entrypoints.

    main entrypoint: server-compatible logic (command, link map, portal builder, teleport). Must not reference client-only classes.

    client entrypoint: overlay Mixin registration, client packet receiver, client state flag. Only loaded when the mod is present on the client.

    Set "environment": "*" so the mod loads on both sides, with each side executing only its own entrypoint.

5. The known Fabric API handshake issue.

    On 1.21+, Fabric API itself may reject vanilla clients with "This server requires Fabric Loader and Fabric API installed on your client!" .

    If your mod depends on Fabric API, note this in the README and recommend Bypass Fabric Check (server-side only, toggles the handshake check) as a workaround for server owners who want vanilla clients to join .

    Alternatively, if the server-side portion can run on Fabric Loader alone without Fabric API, do that—it sidesteps the handshake issue entirely. State which path you chose and why.

Verification the AI must provide:

    A test plan: start server with the mod, join with (a) a modded client, (b) a vanilla client.

        Modded client: command works, portals appear, teleport works, overlay renders.

        Vanilla client: command works, portals appear, teleport works, no overlay, no kick, no registry error.

    Confirm no S2C packet is sent to a client that canSend returns false for.

    Confirm no new registry entries exist that would affect vanilla clients.

Do not:

    Revert to a purely server-side mod and delete the overlay code—the overlay is wanted for modded clients.

    Send custom packets unconditionally and let vanilla clients error out.

    Add any registry entry that requires client-side registration.
Kodari AI
KodariWed at 3:51 pm 5

Vanilla clients can’t decode the current custom command argument, so I’ll replace its network-visible command node with a vanilla argument while keeping the optional overlay packet guarded by canSend.

Updated the command tree to use a vanilla-compatible argument while retaining the optional client overlay. Both overlay packet sends check canSend first; no custom blocks, items, entities, or command argument registry entries remain.

The README includes the modded- and vanilla-client test plan and the Fabric handshake workaround. Vanilla joining and overlay rendering have not been tested; other server mods or handshake restrictions may still prevent a vanilla client from connecting.

BTD 6
📎 1 file 4,768 chars
📄
pasted-code-1795024572250.txt
txt 53 lines
▶
New feature: Add exit portal dimension selection to /ntp command.

Keep all previously agreed behavior (clear space before building, chunk loading, hard linking, teleport delay, optional client overlay), and extend the command syntax so users can specify the dimension where the exit portal will be placed. If no dimension is specified, default to the sender's current dimension.

Command syntax (add optional dimension parameter on top of existing forms):

    /ntp   — exit portal is placed in the specified dimension, position is 2 blocks in front of  player (if target is a player) or at specified coordinates.

    /ntp     — same as above, with specified size.

    /ntp    — enter portal is 2 blocks in front of , exit portal is 2 blocks in front of  player, but exit portal is placed in the  dimension.

    /ntp      — same as above, with size.

Parsing rules (must be correct):

    Use Minecraft's built-in DimensionArgumentType.dimension() to parse the dimension parameter. It returns a ServerLevel (or the corresponding ServerWorld type in 1.21.11 mappings), and supports tab-completion of existing dimension IDs (such as minecraft:overworld, minecraft:the_nether, minecraft:the_end).

    The dimension parameter is optional. If omitted, the exit portal is placed in the same dimension as the command sender. The default value must be handled in the command tree via .executes() at the appropriate node, not by guessing within the argument parser.

    Disambiguation: After the target parameter, if the next token matches a dimension ID format (contains : or is a known dimension), it is parsed as a dimension; otherwise, proceed according to the original rules for size/coordinates/players. Prioritize using Brigadier's argument type system to handle this naturally, avoiding custom string judgment.

Behavior rules:

    Exit portal placement: Use the ServerWorld parsed by the dimension parameter as the target world, and execute the clear-space-before-building logic in that world. The enter portal is still placed in the sender's current world (or the world where target1 is located).

    Coordinate validity: If the exit portal coordinates are out of bounds in the target dimension (Y-axis out of range) or the chunk cannot be loaded, fail gracefully with a clear error message.

    Cross-dimension linking: The link map's key must include dimension + coordinates (for example, ResourceKey + BlockPos). When a player enters the enter portal, look up the exit portal in the target dimension based on the link map, and use FabricDimensions.teleport() to complete the cross-dimension teleport.

    Teleport delay and overlay: The delay logic remains unchanged (server-side tick count), but when the teleport completes, call FabricDimensions.teleport(player, targetWorld, teleportTarget) instead of same-dimension teleportTo. The client overlay (if the player has the mod installed) only needs to know "currently in linked portal"; it does not need to know about dimension switching, so no additional handling is required.

    Player target cross-dimension scenario: If  is a player, they may be in a different dimension than the specified . In this case, "2 blocks in front of that player" should be calculated based on the player's position in the specified dimension — but if the player is not in that dimension, the command should fail and prompt "target player is not in the specified dimension."

Error cases (each with its own message):

    Specified dimension does not exist / cannot be parsed.

    Target player is not in the specified dimension (when exit portal is player-targeted).

    Exit portal coordinates are invalid in the target dimension (out of bounds or chunk cannot be loaded).

    Enter portal and exit portal are in the same dimension and at the same coordinates (self-linking).

Do not:

    Guess dimension IDs by string matching; use DimensionArgumentType.

    Put the exit portal's clear-space-before-building logic in the sender's world; it must execute in the target dimension's world.

    Change the same-dimension behavior when the dimension parameter is omitted.

Deliverables: Updated command registration code (showing how DimensionArgumentType is embedded and how the default dimension is handled), the updated buildPortalPair method signature (accepting two ServerWorld instances), the update to the link map key (including dimension), and the call location for FabricDimensions.teleport(). Comments should state how dimension parsing and default values are handled, and how the cross-dimension link map is keyed.
Kodari AI
KodariWed at 6:04 pm 8

I’ll preserve vanilla-client compatibility by parsing the dimension with Minecraft’s DimensionArgumentType inside the existing greedy-string command. Links will store a dimension for each endpoint; older saved links will remain readable.

Added dimension selection and cross-dimension link persistence. Existing saved links remain compatible, and omitted dimensions default to the command source’s world.

The command keeps its vanilla-client-compatible argument tree and uses DimensionArgumentType to parse dimension IDs internally. Teleportation uses vanilla’s portal pipeline with a cross-dimension TeleportTarget, rather than a direct FabricDimensions.teleport() call.

The changes have not been compiled or tested in-game.

BTD 6

add (/mntp <coordinates of the main portal> <rotation of the main portal> <coordinates of the 1 portal> <rotation of the 1 portal> <coordinates of the 2 portal> <rotation of the 2 portal> [and 3 4 5 6 ... 256] <portals size[standart is 5 4 max is 32 32 and min is 3 3]>) rotation is north, west, south, east so the player exits east for example. You can use players instead of coordinates. Any portal of 1...256 teleports the player to the main portal and the main portal teleports the player to a random portal 1...256

Kodari AI
KodariYesterday at 7:01 pm 3

I’ll add /mntp with a shared size, validate and load every footprint before building, and persist the main-to-many links with each portal’s exit direction. Existing /ntp links will keep their current behavior.

Added /mntp with one main portal and 1–256 destinations. Each endpoint accepts coordinates or an online player name, followed by north, south, east, or west. The main portal selects a destination randomly; destinations return to the main portal.

Example: /mntp 0 64 0 east Alex north 100 64 100 west 5 4

Size defaults to 5×4 and accepts 3–32 for each dimension. Caveat: vanilla validates portal interiors only up to 21×21, so larger frames may break on later block updates. The change has not been compiled or tested in-game.

BTD 6

make 21x21 the max

Kodari AI
KodariYesterday at 7:09 pm 1

Set the maximum portal frame size to 21×21 for both /ntp and /mntp.

BTD 6

fix the bug where the player teleports one block in front of the portal

Kodari AI
KodariYesterday at 7:15 pm 1

Removed the forward offset, so players arrive inside the destination portal while still facing its configured direction.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
README.md
settings.gradle
Code
18 995
src/client/java/dev/kodari/ntp/NtpClient.java
package dev.kodari.ntp;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientWorldEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;

public class NtpClient implements ClientModInitializer {
    private static boolean waiting;
    private static boolean suppressVanillaFade;
    private static int waitTicks;

    @Override
    public void onInitializeClient() {
        ClientPlayNetworking.registerGlobalReceiver(PortalWaitPayload.ID, (payload, context) -> {
            if (payload.waiting()) {
                if (!waiting) waitTicks = 0;
                waiting = true;
                suppressVanillaFade = false;
            } else {
                // The server sends stop on cancellation and before teleport completion.
                waiting = false;
                waitTicks = 0;
                suppressVanillaFade = true;
            }
        });
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            if (waiting && waitTicks < PortalLinks.PORTAL_DELAY_TICKS) waitTicks++;
            if (!waiting && suppressVanillaFade && client.player != null
                    && client.player.nauseaIntensity <= 0.0F && client.player.lastNauseaIntensity <= 0.0F) {
                suppressVanillaFade = false;
            }
        });
        // Never carry a pending portal overlay across disconnects or world changes.
        ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> reset());
        ClientWorldEvents.AFTER_CLIENT_WORLD_CHANGE.register((client, world) -> reset());
    }

    public static float portalOverlayIntensity(float vanillaIntensity) {
        if (waiting) return Math.max(0.0125F, Math.min(1.0F, waitTicks / 80.0F));
        return suppressVanillaFade ? 0.0F : vanillaIntensity;
    }

    private static void reset() {
        waiting = false;
        suppressVanillaFade = false;
        waitTicks = 0;
    }
}