๐
pasted-code-1791877990015.txt
txt
223 lines
โถ
# Minecraft Fabric 1.21.11 โ Nine Elemental Sticks Mod
## Project Requirements
Create a complete, working Minecraft Fabric mod for **Minecraft Java Edition 1.21.11** using the correct Fabric Loader, Fabric API, Java version, and Yarn or Mojang mappings compatible with this version.
The mod must add **9 unique Elemental Sticks**, each with its own special ability, visual effects, sound effects, cooldown, and crafting recipe.
The mod must work on a multiplayer Fabric server and must not depend on Bukkit, Spigot, Paper, or Forge.
## 1. Lightning Stick โก
**Ability: Lightning Strike**
- When the player right-clicks while holding the stick, summon a lightning bolt at the block or entity targeted by the player's crosshair.
- Maximum targeting distance: 25 blocks.
- If targeting an entity, strike that entity's location.
- If targeting a block, strike just above the targeted block.
- Deal 8 hearts of damage to nearby hostile targets, subject to Minecraft's normal damage mechanics.
- Create lightning particles and a thunder sound.
- Cooldown: 8 seconds.
- Prevent the ability from repeatedly activating while the right mouse button is held.
## 2. Fire Stick ๐ฅ
**Ability: Flame Burst**
- Right-click to create an explosion-like burst of fire at the targeted location.
- Range: 20 blocks.
- Deal fire damage to nearby hostile mobs.
- Ignite affected hostile mobs for 5 seconds.
- Spawn flame and smoke particles with a fire sound.
- Do not destroy blocks or create terrain damage.
- Cooldown: 8 seconds.
## 3. Water Stick ๐
**Ability: Water Surge**
- Right-click to launch a powerful wave of water toward the targeted location.
- Push nearby hostile mobs away from the impact point.
- Deal moderate damage and apply Slowness for 4 seconds.
- Create splash particles and water sounds.
- Do not permanently flood the world or destroy blocks.
- Cooldown: 7 seconds.
## 4. Earth Stick ๐ชจ
**Ability: Earthquake**
- Right-click to create a ground shockwave around the targeted location.
- Affect hostile mobs within a 6-block radius.
- Deal moderate damage and apply Slowness for 3 seconds.
- Create block-crack particles, dust particles, and a rumbling sound.
- Do not permanently modify terrain.
- Cooldown: 10 seconds.
## 5. Wind Stick ๐ช๏ธ
**Ability: Wind Gust**
- Right-click to unleash a powerful gust toward the targeted location.
- Knock hostile mobs backward and slightly upward.
- Push nearby entities away from the impact point.
- Create cloud particles and a strong wind sound.
- Do not cause fall damage directly through the ability.
- Cooldown: 6 seconds.
## 6. Ice Stick โ๏ธ
**Ability: Frost Nova**
- Right-click to release an icy blast around the targeted location.
- Freeze or slow hostile mobs within a 6-block radius.
- Apply Slowness for 5 seconds.
- Deal moderate ice-themed damage.
- Create snowflake-like particles and a freezing sound.
- Do not permanently freeze water or modify terrain.
- Cooldown: 8 seconds.
## 7. Nature Stick ๐ฟ
**Ability: Nature's Wrath**
- Right-click to summon magical roots beneath nearby hostile mobs.
- Immobilize affected mobs briefly using a movement-restricting effect or suitable custom mechanic.
- Deal moderate damage.
- Create green particles, leaf particles, and a magical nature sound.
- The effect must expire automatically after 4 seconds.
- Do not permanently change the landscape.
- Cooldown: 9 seconds.
## 8. Shadow Stick ๐
**Ability: Shadow Rift**
- Right-click to teleport the player to a safe location near the targeted point, up to 15 blocks away.
- Search for a safe landing position and prevent teleportation inside solid blocks, into lava, or into the void.
- Create dark particles at both the departure and arrival locations.
- Play a mysterious teleport sound.
- If no safe destination exists, cancel the ability and display a message.
- Cooldown: 10 seconds.
## 9. Light Stick โ๏ธ
**Ability: Holy Burst**
- Right-click to release a burst of magical light at the targeted location.
- Damage hostile mobs within a 6-block radius.
- Apply Glowing to affected hostile mobs for 6 seconds.
- Create bright particles and a magical chime sound.
- Optionally heal the caster by 2 hearts, with proper health limits.
- Cooldown: 9 seconds.
# Item Design and Identification
Each stick must have:
- A unique item name and description in its tooltip.
- A unique texture and color scheme.
- A visible cooldown indicator or remaining cooldown message.
- A distinct ability activation sound.
- Appropriate particles matching its element.
- A unique item identifier so the nine sticks can never be confused with each other.
Use custom item models and textures if practical. If the resource pack is required for custom models, include it with the project and document how to install it.
Do not identify the sticks using their display names alone. Use unique registered items or reliable custom item data.
# Activation System
- All nine sticks activate through right-click.
- Use the server to validate and execute abilities.
- Prevent abilities from activating when the player is on cooldown.
- Show a clear message such as "Lightning Stick is ready in 4 seconds!" when an ability is still cooling down.
- Use a configurable targeting distance for each ability.
- Correctly handle targeting blocks, entities, and empty space.
- Ensure abilities do not repeatedly trigger every tick.
- Add configurable friendly-fire behavior and prevent accidental damage to the caster.
- Allow server owners to configure damage, cooldowns, ranges, and effects.
# Crafting Recipes
Create a different, balanced crafting recipe for each of the nine sticks.
Each recipe must:
- Use vanilla Minecraft materials and, where appropriate, Nether or End materials.
- Reflect the element and strength of the ability.
- Be unique to that stick.
- Be registered in the proper recipe format for Minecraft 1.21.11.
- Appear in the recipe book after the player unlocks it.
- Have a recipe unlock mechanism or command that grants the correct recipe knowledge.
Suggested materials:
- Lightning: Lightning Rod, Copper, Amethyst Shard.
- Fire: Blaze Rod, Magma Cream, Blaze Powder.
- Water: Heart of the Sea, Prismarine Shard, Nautilus Shell.
- Earth: Obsidian, Iron Ingot, Stone.
- Wind: Breeze Rod, Feather, Phantom Membrane.
- Ice: Packed Ice, Blue Ice, Snowball.
- Nature: Moss Block, Vine, Emerald.
- Shadow: Echo Shard, Ender Pearl, Obsidian.
- Light: Glowstone, Sea Lantern, Nether Star.
Balance the recipes so that stronger abilities require rarer ingredients. Do not make every stick use the same recipe.
# Commands
Implement the following working commands:
/elemental help
Displays all commands and a brief explanation of each stick.
/elemental give
Gives the specified player the selected elemental stick.
/elemental giveall
Gives all nine elemental sticks to the specified player.
/elemental list
Lists all nine sticks and their abilities.
/elemental cooldown reset
Resets the selected stick's cooldown.
/elemental reload
Reloads the mod's configurable settings where supported.
Add tab completion for player names, elements, and subcommands.
Only server operators or players with an explicitly granted permission may use administrative commands. Regular players must not be able to give themselves items or bypass permissions.
# Configuration
Generate a configuration file containing:
- Damage per stick.
- Ability cooldowns.
- Targeting ranges.
- Area-of-effect radius.
- Player damage enabled/disabled.
- Friendly fire enabled/disabled.
- Particle and sound effects enabled/disabled.
- Individual abilities enabled/disabled.
Validate configuration values to prevent crashes or unreasonable values.
# Technical Requirements
1. Build a complete Fabric mod project, not a Bukkit plugin.
2. Register all nine items correctly for Minecraft 1.21.11.
3. Use the correct item interaction APIs for the target version.
4. Ensure server-authoritative ability execution for multiplayer.
5. Include all Java source files, Gradle files, Fabric metadata, resources, item definitions, recipes, and configuration files.
6. Avoid obsolete methods, incompatible dependencies, and incorrect recipe JSON formats.
7. Prevent crashes caused by null targets, unloaded chunks, invalid locations, or missing entities.
8. Ensure cooldowns are tracked separately for each player and each elemental stick.
9. Persist only the data that needs to survive a restart.
10. Avoid excessive particle spawning or expensive operations that could lag the server.
# Final Testing and Delivery
Before declaring the mod complete:
- Compile the project successfully.
- Test all nine abilities in single-player and on a dedicated multiplayer Fabric server.
- Test every stick's recipe and recipe-book unlock.
- Verify that each cooldown works independently.
- Verify that no ability causes unwanted permanent terrain damage.
- Verify that permissions and commands work correctly.
- Fix all compilation errors and runtime exceptions.
Deliver the complete source project and a compiled .jar file that works on Fabric 1.21.11. Include installation instructions and a README explaining every ability, recipe, command, and configuration option.
Do not provide placeholder abilities, fake commands, incomplete code, or a JAR that has not been built successfully.
Plan:
Look up the Fabric 1.21.11 APIs the mod touches: items, registry, commands, targeting, damage, effects, particles, sounds, teleport, recipes and advancements.
Generate the nine stick textures.
Write the Gradle and Fabric metadata, the Java sources, and the data and asset JSON.
Write the README, then deliver the build.
Starting with the lookups and textures together.
All nine textures are generated. Before writing code, I still need the import paths for a few types and the Fabric creative-tab builder.
Most APIs are confirmed. Next Iโm checking the last few signatures: command feedback, permission predicate, item stack and hand helpers, action results, and the remaining sound and recipe-key names.
Two more checks before writing: entity UUID and name accessors, the hit-result type enum, and the recipe, status-effect and damage-source class paths.
I have what I need. Writing the build files and Java sources now. The APIs are verified against the mounted source.
Java sources are in. Now the data and asset files: item definitions, models, recipes, recipe-unlock advancements, language file and README.
The Elemental Sticks mod is written: nine sticks, abilities, cooldowns, recipes, commands, config and README. I have not built the jar or run it in-game or on a server, so treat it as untested until you compile and try it.
To get the jar: click Compile in the top bar (on phone, โฎ โ Compile Project), click Compile in the window, then Download the jar when it succeeds.
Whatโs in the project
Sticks: nine registered items, each with its own texture, item model, tooltip and creative-tab entry under โElemental Sticksโ.
Abilities: all nine run server-side on right-click, with the cooldown, range, radius, damage, effect duration and particle/sound settings from the spec. Targeting handles entities, blocks and empty space. Shadow Rift cancels with a message if no safe landing spot exists.
Cooldowns: tracked per player and per stick, not saved to disk. The vanilla cooldown overlay also shows on the stick, and repeated right-click hold gets a throttled โready in N secondsโ message.
Recipes: nine different 3ร3 shaped recipes built from the suggested materials, with the rarest ingredients on the strongest abilities. Each recipe unlocks in the recipe book when the player obtains any one of its ingredients.
/elemental giveand/elemental giveallalso unlock them.Commands:
help,list,give,giveall,cooldown <player> <element> reset,reload, with tab completion for players and elements.Config:
config/elementalsticks.jsonis created on first launch. Values are clamped to safe ranges.
Things to know
Admin permission: admin commands require operator level 2. The mounted source has no Fabric permission-node API, so โexplicitly granted permissionโ for non-operators is not implemented.
Friendly fire: I interpreted it as โalso affect passive and neutral mobs.โ Your own tamed pets are never hit, and the caster is never hit. Players are only affected if
playerDamageEnabledis on.Nature roots: these use Slowness at maximum level. Rooted mobs stop moving but can still attack or jump.
Unverified formats: the recipe and advancement JSON layouts and the Loom plugin version come from my knowledge, not the mounted source (it has no
data/minecraft). If the build fails or the recipe book doesnโt unlock, check those files first.
Survival access: every stick is craftable, and its recipe unlocks once the player holds one ingredient. The README has the full ability, recipe, command and config tables.
package com.kodari.elementalsticks;
import com.kodari.elementalsticks.command.ElementalCommands;
import com.kodari.elementalsticks.config.ModConfig;
import net.fabricmc.api.ModInitializer;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ElementalSticksMod implements ModInitializer {
public static final String MOD_ID = "elementalsticks";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
@Override
public void onInitialize() {
ModConfig.load();
ModItems.register();
ElementalCommands.register();
}
public static Identifier id(String path) {
return Identifier.of(MOD_ID, path);
}
}