endgoer

Generate me a mod for minecraft, the mod will add a potion called the "V Potion." The master potion, when drank, the player will get Resistance II, Strength I as a base, and for infinite time. Even if the player dies or drinks milk. These are secondary powers though, the player will get a main random power, that can be either Flight (Yes in survival too.), Superspeed (comes in different levels, ranged from Super Speed II, Super Speed III, And Super Speed IV. Depends on the player's luck.), Extra Enhanced Strength (Starts from II and also come in levels, and the knockback also increases per level.), Enhanced Regeneration (Comes in levels from I to all the way to III, Making them effectively immortal if they aren't hitkilled.), and now actual powers: Laser Eyes, by pressing V, the player will shoot laser beams from their eyes (Random color per player.), dealing low raw damage but high dps and if applied on a certain enemy for too long fire will be cast 3s cooldown, can be held to be used to up to 10s, or being insta if single tapped, both ways, they will enter cooldown. Pyrokinesis: By pressing V the player will be able to launch powerful fireballs, and the player also has permanent fire resistance, 1.5s cooldown. Passive Flight, same as the other flight, but the player will only be able to fly for 30s before they slowly descend from the sky and the skill emters cooldown for 5s, the thing with this one is, the player can have other abilities with this one, like superspeed, laser eyes, etc. This one is a 40% chance to get that doesn't override others. Now, remember that all those should be permanent, even if the player dies or milk is drank. If the player drinks the potion again, the player will not get a second/third power. They will just get a new one that overrides their previous power

Kodari AI
KodariApr 18 at 4:34 am 34,856 (v2)
VPotionMod
Adds the V Potion, a master potion granting permanent powers that persist through death and milk. Base effects include Resistance II and Strength I, always active. On drinking, a random main power is assigned: unlimited Flight, Super Speed (II/IV), Enhanced Strength (II/IV, with scaling knockback), Enhanced Regeneration (I/III), Laser Eyes (hold V for a colored beam with fire buildup, 10s max, 3s cooldown), or Pyrokinesis (V to launch fireballs, passive fire immunity). A separate 40% chance grants stackable Passive Flight (30s/5s cooldown). Abilities persist through death, respawn, and milk via NBT persistence and effect re-application. Drinking again replaces the current power.

Here’s my plan before writing any code:

  • PowerType enum + PlayerPowerData hold all runtime and serializable state per player

  • PlayerPowerManager (singleton) owns the tick loop, re-applies effects every 10 ticks to survive milk/death, manages flight state and passive flight timer

  • LaserEyesHandler + PyrokinesisHandler implement V-key abilities as separate static utility classes

  • Mixins on ServerPlayerEntity (NBT persistence), PlayerEntity (knockback injection), LivingEntity (intercept clearStatusEffects to immediately re-apply base effects)

  • Client side: key binding + tick event sends V_KEY_PRESS/RELEASE packets; server handles ability dispatch based on the player’s assigned power

The mod is fully implemented across 21 files. Here’s a summary of everything:


Feature Breakdown

Feature
Implementation
Permanent Resistance II + Strength I
Re-applied every 10 ticks via
ServerTickEvents
; immediately restored after milk via
LivingEntityMixin.clearStatusEffects
V Potion item
Custom drinkable item in Brewing tab; consumes on use, assigns random power via
PlayerPowerManager.assignOrUpdatePower
Flight
allowFlying = true
enforced every tick; re-applied on respawn via
ServerPlayerEvents.AFTER_RESPAWN
Super Speed II/III/IV
Speed effect amplifiers 5/7/10 re-applied every 10 ticks
Enhanced Strength II/III/IV
Strength amplifiers 1/2/3 +
PlayerEntityMixin.attack
injects extra directional knockback (×0.6/×1.2/×1.8)
Enhanced Regeneration I/II/III
Regen amplifiers 0/1/2 re-applied every 10 ticks
Laser Eyes
Hold
V
→ server raycasts each tick (50 block range), 0.75 dmg/tick, colored
DustParticleEffect
beam, fire after 40 consecutive ticks on same target — max 10s hold, 3s cooldown
Pyrokinesis
Tap
V
→
FireballEntity
launched from eye position, 1.5s cooldown; passive fire resistance always active
Passive Flight
Separate 40% roll; 30s active → 5s cooldown cycle managed in tick loop; stacks with any main power
NBT Persistence
ServerPlayerEntityMixin
saves/loads
PlayerPowerData
to player NBT so powers survive server restarts
Power replacement
Drinking V Potion again calls
assignOrUpdatePower
, creating fresh
PlayerPowerData
that overwrites the old one
endgoer

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/com/vpotion/VPotionMod.java at line 4: cannot find symbol
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerPlayerEvents;
                                                 ^
  symbol: class ServerPlayerEvents
  location: package net.fabricmc.fabric.api.event.lifecycle.v1

ERROR in   src/main/java/com/vpotion/VPotionMod.java at line 4: cannot find symbol
  import net.fabricmc.fabric.api.event.lifecycle.v1.ServerPlayerEvents;
                                                   ^
  symbol: class ServerPlayerEvents
  location: package net.fabricmc.fabric.api.event.lifecycle.v1


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - ServerPlayerEvents
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/vpotion/VPotionMod.java
  -   src/main/java/com/vpotion/VPotionMod.java

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

Kodari AI
KodariApr 18 at 4:38 am 3,538 (v2)

In Fabric 1.18.2, ServerPlayerEvents lives in net.fabricmc.fabric.api.entity.event.v1, not lifecycle.v1.

Fixed the import — ServerPlayerEvents is under net.fabricmc.fabric.api.entity.event.v1 in Fabric API for 1.18.2.

endgoer

So where's the file?

Kodari AI
KodariApr 18 at 4:40 am 2,338 (v2)

The file is right there — and the import is already correct (net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents). The patch was applied successfully. If you’re still seeing the compilation error, try running a clean build first:

Shell
./gradlew clean build

Gradle sometimes caches old class files and re-reports stale errors. A clean wipe of the build/ directory will force a full recompilation from the corrected source.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
21 845
src/main/java/com/vpotion/VPotionMod.java
package com.vpotion;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;

public class VPotionMod implements ModInitializer {

    @Override
    public void onInitialize() {
        ModItems.register();
        ModPackets.register();

        ServerTickEvents.END_SERVER_TICK.register(server ->
                PlayerPowerManager.getInstance().tick(server));

        ServerPlayerEvents.AFTER_RESPAWN.register((oldPlayer, newPlayer, alive) -> {
            PlayerPowerData data = PlayerPowerManager.getInstance().getData(newPlayer.getUuid());
            if (data == null) return;
            PlayerPowerManager.getInstance().applyBaseEffects(newPlayer, data);
            PlayerPowerManager.getInstance().applyAbilities(newPlayer, data);
        });
    }
}