zeth mendiola

Act as an expert Minecraft Java mod developer. Write the code for a Fabric/Forge [choose your loader] mod for Minecraft version [insert version, e.g., 1.21] where trees fight back against the player.

Key mechanics:

  1. When a player breaks a log block belonging to a natural tree (Oak, Birch, Spruce, etc.), there is a 10% chance that the tree wakes up and turns hostile.
  2. The tree transforms into a custom hostile mob (or an invisible zombie riding a custom armor stand made of logs) that looks like a walking tree.
  3. The "Attacker Tree" mob should have 100 hit points (50 hearts), move slowly, and deal high knockback and 4 hearts of damage per hit.
  4. When defeated, it should drop normal logs, saplings, and a rare custom item.

Please provide the main class, entity registration, and the event listener for block-breaking.

Kodari AI
KodariOct 25 at 1:24 pm 14
TreeRevengeMod
TreeRevengeMod is a Fabric mod for Minecraft 1.21 that makes trees fight back. When a player breaks a log from a natural tree, there is a 10% chance the tree awakens as a hostile walking-tree entity. This custom mob has 100 HP, moves slowly, deals 4 hearts of damage with high knockback, and drops logs, saplings, and a rare custom item when defeated. The mod includes entity registration, custom AI, and block-break event handling.
  • Build a Fabric 26.3 mod scaffold and register the Attacker Tree mob and rare drop.

  • Add the 10% natural-tree break trigger, matching log/sapling drops, and hostile combat stats.

  • Create and wire a custom walking-tree model and its renderer.

Created a Fabric 26.3 mod with an animated walking-tree model and custom spawn egg.

  • Breaking a supported tree log near leaves has a 10% chance to summon an Attacker Tree. It has 100 health, moves slowly, deals 8 damage and has high knockback.

  • On defeat, it drops 2–4 matching logs and 1–2 matching saplings. There’s a 5% chance for a Heartwood Knot and a 1% chance for its spawn egg.

  • In survival, chop logs to awaken one, then defeat it for its drops; the spawn egg can also summon the mob.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
19 441
src/client/java/com/kodari/angrytrees/client/AngryTreesClient.java
package com.kodari.angrytrees.client;

import com.kodari.angrytrees.ModEntities;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;

public final class AngryTreesClient implements ClientModInitializer {
    @Override
    public void onInitializeClient() {
        EntityRendererRegistry.register(ModEntities.ATTACKER_TREE, AttackerTreeRenderer::new);
    }
}