PandeyRudraNath Roy

Make me a mod that instantly places water when the player using the mod looks down in the cobweb

Kodari AI
KodariToday at 6:52 am 1
WebWaterPlacer
A Minecraft Fabric mod for version 1.21.11 that instantly places water blocks when the player looks downward while inside a cobweb. The mod detects when the player's view direction is facing down and their position intersects with a cobweb block, then replaces the cobweb with a water source block. It provides a seamless, automatic water placement mechanism for escaping or clearing cobwebs, with configurable activation and placement logic integrated into the game's tick system.
  • Detect when the player is inside a cobweb and looking down.

  • Use a held water bucket through the normal client interaction path.

Created the client-side mod. Hold a water bucket in either hand and look down while inside a cobweb to automatically use it. Normal placement rules still apply.

PandeyRudraNath Roy

Make it not auto and once web is destroyed the player auto collets the water

Kodari AI
KodariToday at 6:55 am 2
  • Leave water placement manual.

  • Collect the water automatically after it replaces a cobweb, using an empty bucket.

Place the water yourself; the mod then attempts to collect it once the cobweb is gone. Keep the empty bucket in the same hand.

PandeyRudraNath Roy

Now make it that when the player is on fire it instantly places water when the player is looking down and collects the water instantly

Kodari AI
KodariToday at 6:57 am 2
  • Keep manual cobweb placement and its existing collection behavior.

  • Add automatic placement when burning and looking down, then collect the water after the fire is out.

Added automatic water placement when you’re on fire and looking down. The mod attempts to collect it once you’re extinguished.

Keep a water bucket in either hand; normal placement and reach rules apply. Cobweb placement remains manual.

PandeyRudraNath Roy

Now make that it doesnt get caught and rename it as cobweb optimser

Kodari AI
KodariToday at 7:23 am 1
  1. Rename the mod to Cobweb Optimiser.

  2. Clarify what “doesn’t get caught” means before changing its behavior.

Renamed the mod Cobweb Optimiser.

By “doesn’t get caught,” do you mean avoiding getting stuck in cobwebs, or avoiding server anti-cheat detection?

PandeyRudraNath Roy

Yes

Kodari AI
KodariToday at 7:23 am 1

Do you mean avoiding getting stuck in cobwebs, or avoiding server anti-cheat detection?

PandeyRudraNath Roy

Both

Kodari AI
KodariToday at 7:25 am 1
  • Automatically place water when you’re caught in a cobweb.

  • Use normal interactions without promising anti-cheat bypass or undetectability.

Cobweb Optimiser now attempts to place water when you’re in a cobweb and looking down, then collect it afterward. Keep a water bucket in either hand.

It uses normal item interactions, but automatic actions can still be detected or prohibited by server anti-cheat rules.

PandeyRudraNath Roy

Now make it compatible with MJ launcher

Kodari AI
KodariToday at 7:32 am 1

Which MJ Launcher do you mean? Please share a link or say whether it’s on Android or desktop. Cobweb Optimiser needs a launcher that can run Fabric 1.21.11.

PandeyRudraNath Roy

Android

Kodari AI
KodariToday at 7:32 am 1

If MJ Launcher supports Minecraft Java Edition 1.21.11 with Fabric, Cobweb Optimiser can run through it: select the Fabric profile and place the compiled mod JAR and Fabric API in that profile’s mods folder.

I can’t confirm MJ Launcher’s Fabric support from its name alone. Send me its link if you’d like me to check.

PandeyRudraNath Roy

Like mojo launcher

Kodari AI
KodariToday at 7:33 am 1

Cobweb Optimiser should work with Mojo Launcher if it runs Minecraft Java Edition 1.21.11 with Fabric. Install Fabric API and the mod JAR in that profile’s mods folder.

No Android-specific code change should be needed, though I haven’t verified it on Mojo Launcher.

PandeyRudraNath Roy

So do verify

Kodari AI
KodariToday at 7:34 am 1

I can’t verify compatibility on an Android device from here, and I don’t have a confirmed Mojo Launcher source to check its supported versions. Send me its website or download link, and I can check whether it supports Fabric 1.21.11.

PandeyRudraNath Roy

Check

Kodari AI
KodariToday at 7:34 am 1

I can check Mojo Launcher’s documentation, but I need its website or download-page link. I can’t verify actual in-game behavior on an Android device from here.

PandeyRudraNath Roy

Releases · MojoLauncher/MojoLauncher · GitHub https://share.google/TczTe1Y7N4SmFNsy3

Kodari AI
KodariToday at 7:35 am 1

I checked Mojo Launcher’s official repository: it supports Minecraft Java Edition on Android and Fabric mods. Cobweb Optimiser should be compatible when you use a Minecraft 1.21.11 Fabric profile with Fabric API installed.

That verifies launcher support, not an in-game test of this mod on Android.

PandeyRudraNath Roy

Now make this that whenever the oppoenent get caught on anyones web it places lava on the web

Kodari AI
KodariToday at 7:51 am 2

I’ll add lava placement for other players caught in cobwebs, while keeping the existing water behavior. Placement will still depend on reach, line of sight, and normal bucket rules.

Added automatic lava placement for other players caught in cobwebs. Hold a lava bucket in either hand.

Placement is attempted only when a suitable block face is visible and within reach; normal server and bucket rules still apply.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
5 258
src/client/java/com/kodari/cobwebwater/CobwebWaterClient.java
package com.kodari.cobwebwater;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.block.Blocks;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RaycastContext;

import java.util.HashSet;
import java.util.Set;

public class CobwebWaterClient implements ClientModInitializer {
    private ClientWorld world;
    private BlockPos web;
    private Hand bucketHand;
    private final Set<BlockPos> existingWater = new HashSet<>();
    private int remaining;
    private int cooldown;
    private boolean fireAttempt;

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            if (client.player == null || client.world == null || client.interactionManager == null) {
                world = null;
                web = null;
                remaining = 0;
                cooldown = 0;
                fireAttempt = false;
                return;
            }
            if (world != client.world) {
                world = client.world;
                web = null;
                remaining = 0;
                cooldown = 0;
                fireAttempt = false;
            }

            if (cooldown > 0) cooldown--;
            Hand waterHand = null;
            if (client.player.getStackInHand(Hand.MAIN_HAND).isOf(Items.WATER_BUCKET)) waterHand = Hand.MAIN_HAND;
            else if (client.player.getStackInHand(Hand.OFF_HAND).isOf(Items.WATER_BUCKET)) waterHand = Hand.OFF_HAND;

            Hand lavaHand = null;
            if (client.player.getStackInHand(Hand.MAIN_HAND).isOf(Items.LAVA_BUCKET)) lavaHand = Hand.MAIN_HAND;
            else if (client.player.getStackInHand(Hand.OFF_HAND).isOf(Items.LAVA_BUCKET)) lavaHand = Hand.OFF_HAND;
            if (cooldown == 0 && lavaHand != null) {
                Vec3d eye = client.player.getEyePos();
                double range = client.player.getBlockInteractionRange();
                for (var other : world.getPlayers()) {
                    if (other == client.player || !other.isAlive() || other.isSpectator()) continue;
                    Box box = other.getBoundingBox();
                    for (BlockPos pos : BlockPos.iterate(box)) {
                        if (!new Box(pos).intersects(box) || !world.getBlockState(pos).isOf(Blocks.COBWEB)) continue;
                        for (Direction direction : Direction.values()) {
                            Vec3d target = Vec3d.ofCenter(pos.offset(direction));
                            double dx = target.x - eye.x;
                            double dy = target.y - eye.y;
                            double dz = target.z - eye.z;
                            if (dx * dx + dy * dy + dz * dz > range * range) continue;
                            BlockHitResult hit = world.raycast(new RaycastContext(eye, target,
                                    RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.NONE, client.player));
                            if (hit.getType() != HitResult.Type.BLOCK
                                    || !hit.getBlockPos().offset(hit.getSide()).equals(pos)) continue;
                            float yaw = client.player.getYaw();
                            float pitch = client.player.getPitch();
                            client.player.setYaw((float) Math.toDegrees(Math.atan2(-dx, dz)));
                            client.player.setPitch((float) -Math.toDegrees(Math.atan2(dy, Math.sqrt(dx * dx + dz * dz))));
                            try {
                                client.interactionManager.interactItem(client.player, lavaHand);
                            } finally {
                                client.player.setYaw(yaw);
                                client.player.setPitch(pitch);
                            }
                            cooldown = 5;
                            return;
                        }
                    }
                }
            }

            if (!fireAttempt && cooldown == 0 && waterHand != null
                    && client.player.isOnFire() && client.player.getPitch() >= 60.0f) {
                web = client.player.getBlockPos().toImmutable();
                bucketHand = waterHand;
                remaining = 60;
                fireAttempt = true;
                existingWater.clear();
                for (BlockPos nearby : BlockPos.iterate(web.getX() - 2, web.getY() - 2, web.getZ() - 2,
                        web.getX() + 2, web.getY() + 2, web.getZ() + 2)) {
                    if (world.getFluidState(nearby).isOf(Fluids.WATER)) existingWater.add(nearby.toImmutable());
                }
                client.interactionManager.interactItem(client.player, bucketHand);
                return;
            }

            if (!fireAttempt && web == null && cooldown == 0 && waterHand != null
                    && client.player.getPitch() >= 60.0f) {
                Box box = client.player.getBoundingBox();
                for (BlockPos pos : BlockPos.iterate(box)) {
                    if (new Box(pos).intersects(box) && world.getBlockState(pos).isOf(Blocks.COBWEB)) {
                        web = pos.toImmutable();
                        bucketHand = waterHand;
                        remaining = 60;
                        existingWater.clear();
                        for (BlockPos nearby : BlockPos.iterate(web.getX() - 2, web.getY() - 2, web.getZ() - 2,
                                web.getX() + 2, web.getY() + 2, web.getZ() + 2)) {
                            if (world.getFluidState(nearby).isOf(Fluids.WATER)) existingWater.add(nearby.toImmutable());
                        }
                        client.interactionManager.interactItem(client.player, bucketHand);
                        cooldown = 5;
                        return;
                    }
                }
            }
            if (web == null || remaining-- <= 0) {
                web = null;
                fireAttempt = false;
                return;
            }
            if (cooldown > 0 || (fireAttempt && client.player.isOnFire())
                    || (!fireAttempt && world.getBlockState(web).isOf(Blocks.COBWEB))
                    || !client.player.getStackInHand(bucketHand).isOf(Items.BUCKET)) return;

            Vec3d eye = client.player.getEyePos();
            BlockPos target = null;
            double closest = 20.25;
            for (BlockPos pos : BlockPos.iterate(web.getX() - 2, web.getY() - 2, web.getZ() - 2,
                    web.getX() + 2, web.getY() + 2, web.getZ() + 2)) {
                if (!existingWater.contains(pos) && world.getFluidState(pos).isOf(Fluids.WATER)
                        && world.getFluidState(pos).isStill()) {
                    double dx = pos.getX() + 0.5 - eye.x;
                    double dy = pos.getY() + 0.5 - eye.y;
                    double dz = pos.getZ() + 0.5 - eye.z;
                    double distance = dx * dx + dy * dy + dz * dz;
                    if (distance < closest) {
                        closest = distance;
                        target = pos.toImmutable();
                    }
                }
            }
            if (target == null) return;

            double dx = target.getX() + 0.5 - eye.x;
            double dy = target.getY() + 0.5 - eye.y;
            double dz = target.getZ() + 0.5 - eye.z;
            float yaw = client.player.getYaw();
            float pitch = client.player.getPitch();
            client.player.setYaw((float) Math.toDegrees(Math.atan2(-dx, dz)));
            client.player.setPitch((float) -Math.toDegrees(Math.atan2(dy, Math.sqrt(dx * dx + dz * dz))));
            try {
                client.interactionManager.interactItem(client.player, bucketHand);
            } finally {
                client.player.setYaw(yaw);
                client.player.setPitch(pitch);
            }
            cooldown = 5;
            if (fireAttempt && client.player.getStackInHand(bucketHand).isOf(Items.WATER_BUCKET)) {
                fireAttempt = false;
                web = null;
            }
        });
    }
}