Implement a Fabric 26.2 mod for permanent randomly assigned player effects. Persist each player's assigned effect and level across logout, death and server restart. On first join assign uniformly from Haste, Hero of the Village, Strength, Speed, Luck, Regeneration, Saturation, Fire Resistance, Dolphin's Grace, Health Boost. Player-vs-player kills increase killer's level and deaths decrease victim's level; avoid duplicate credit. For the eight ordinary effects use displayed integer levels -5 to +5, initially 0; nominal strength = vanilla level 1 + 0.2 per displayed level, with -5 inactive and +5 equivalent to vanilla level 2. Implement fractional scaling as faithfully as possible using custom mechanics where vanilla integer potion amplifiers cannot represent fractions; preserve vanilla-level endpoints and explain any effect that cannot meaningfully scale. Hero starts vanilla I/display 0, gains/loses one vanilla level per kill/death, clamped I–VIII (display 0–7). Health Boost starts with 12 max hearts/display 0, gains or loses one max heart per level, clamped display -4 to +3 (8–15 hearts); preserve current health safely when maximum changes. User's prose inconsistently says -4 is 9 hearts, but the specified 12 + level formula gives 8, and -2 gives 10; use this consistent formula. Show assigned effect name and displayed level in its main potion color in the player's HUD above hearts/armor, including negative and inactive levels. Implement appropriately on both client and server for Fabric. Add craftable drinkable Reroll Potion: nether star center, ominous trial keys in four corners, enchanted golden apples in remaining slots. Give it rainbow bottle appearance where feasible; drinking randomly selects a different effect, broadcasts player and new effect in effect color, resets level to 0 if new effect is Health Boost or Hero, otherwise carries over old display level clamped to ordinary range. Remove old mechanics cleanly on reroll and death and prevent exploits. Implement actual feature code and required mod metadata/resources; do not add tests.

Kodari AI
KodariNov 4 at 10:31 pm 11
FatedEffectsMod
FatedEffectsMod is a Fabric 26.2 mod that permanently assigns each player a unique random effect from ten options on first join, persisting across logout, death, and server restarts. Effects scale with player-versus-player combat: kills increase the killer's displayed level while deaths decrease the victim's, with duplicate credit prevention. Eight ordinary effects use fractional scaling from -5 to +5 displayed levels, mapping to vanilla amplifier equivalents with custom mechanics for precise fractional potency. Hero of the Village progresses through vanilla levels I-VIII, while Health Boost adjusts max hearts from 8 to 15 with safe health preservation. The mod displays the assigned effect name and level in its potion color above the HUD hearts/armor on both client and server. A craftable Reroll Potion with rainbow bottle appearance (nether star, ominous trial keys, enchanted golden apples) lets players randomly select a different effect, broadcasting the change in effect color and resetting or carrying over levels appropriately.
  1. Establish the 26.2 Fabric lifecycle, persistent player state, and client sync.

  2. Implement scaling, rerolls, death/kill progression, and the HUD.

  3. Add the potion item, recipe, textures, and required mod resources.

Implemented the Fabric 26.2 mod with persistent random effect assignments, server/client HUD sync, and PvP progression: deaths reduce the victim’s level, while the responsible player killer gains a level. The effect state survives logout, death, and server restarts.

Ordinary effects use displayed levels -5 to +5; Hero of the Village uses I–VIII (display 0–7), and Health Boost uses 8–15 hearts (display -4 to +3). Health is clamped safely when the maximum changes. Fire Resistance scales fractional levels through a chance to cancel fire damage; Dolphin’s Grace uses fractional uptime. Neither effect meaningfully improves beyond vanilla level I, so higher levels remain equivalent to full strength.

Survival recipe: craft the drinkable Reroll Potion with a nether star in the center, ominous trial keys in the four corners, and enchanted golden apples in the other four slots. Drinking it selects a different effect and broadcasts the result in that effect’s color. Hero and Health Boost rerolls start at level 0; other effects carry over the previous displayed level, clamped to their ordinary range.

Fix crash whenever player left-clicks, and adjust effect HUD. Investigate PlayerMixin.getDestroySpeed injection: it calls cir.setReturnValue but @Inject lacks cancellable = true, likely causing crash when mining/left-click; fix this and inspect related client/server execution for other click crash causes. Preserve haste scaling. Move permanent assigned potion effect name and displayed level to a centered position above the hotbar, like a combat timer, using effect's color; keep synced, visible when appropriate and avoid overlapping hearts/armor as feasible. Existing HUD is in src/client/java/com/kodari/permanenteffects/client/PermanentEffectsClient.java. Implement feature code only.

Kodari AI
KodariNov 4 at 11:32 pm 1
  1. Fix the left-click crash and check nearby mixin/client hooks for related click-time failures.

  2. Move the synced effect label to a centered HUD position above the hotbar.

  1. Fixed the left-click crash by marking getDestroySpeed’s injection cancellable = true; the existing Haste scaling is unchanged. The project has no other click-related hooks calling setReturnValue, and the inspected vanilla mining paths revealed no additional mod-side click callbacks.

  2. Moved the synced, effect-colored label to just above the hotbar, centered at guiHeight - 50. It now attaches before the vanilla hotbar, so it follows the hotbar’s HUD visibility behavior and sits clear of the usual hearts, armor, and experience display.

Update existing Fabric 26.2 mod. On each player death, send only that victim a private chat message 'Your effect is now <effect name> <new displayed level>'; on a credited PvP kill send only killer the same message reflecting their new increased level. Ensure accurate post-change values, including clamps, persistence and respawn. On first-ever assignment only, show the joining player an animated text roulette cycling through all 10 available effects then landing on their actual server-assigned effect, without changing assignment; avoid replay on ordinary rejoin/respawn, sync reliably. Ensure the existing colored name and current displayed level HUD above hotbar reliably reflects actual assigned server state, including respawn and reroll, and remains visible as appropriate; fix any lifecycle/sync issues. Change Reroll Potion shaped recipe to nether star center and ominous trial keys in all other 8 slots. User asks for a '16x16 GUI' for the potion: interpret as a 16x16 pixel inventory item texture/icon, retaining recognizable rainbow potion appearance and drinkable functionality. Inspect existing code/resources and implement feature code only, no tests.

Kodari AI
KodariNov 5 at 1:14 am 5
  1. Add accurate private level-change messages for victim deaths and credited PvP kills.

  2. Implement a first-assignment-only roulette animation and make effect-state sync reliable across respawn and rerolls.

  3. Update the potion recipe and 16×16 rainbow item icon.

  1. Added private, effect-colored messages using the post-clamp level for the victim and credited killer.

  2. Next I’m tracing first-assignment and state-sync lifecycle points for the one-time roulette and reliable HUD refresh.

  1. Private victim/killer messages now report the clamped post-change level.

  2. Added a first-assignment flag to authoritative state sync; the client animates all ten effect names once, then shows the synced effect/level. Rejoin and respawn state updates do not replay it, and disconnect clears stale HUD state.

  3. I’m updating the recipe and resizing the existing potion icon to 16×16 while preserving its rainbow-bottle look.

Implemented the requested updates:

  • Death and credited PvP-kill messages go only to the affected player and show the effect’s post-clamp level in its color.

  • First assignment now triggers a client-side roulette through all ten effects before settling on the server-assigned effect. Ordinary joins, respawns, rerolls, and level updates do not replay it.

  • The HUD uses one atomic synced effect/level state, refreshes from server updates, and clears stale state on disconnect.

  • The reroll recipe now uses a nether star in the center and ominous trial keys in all eight surrounding slots. The existing potion icon is now 16×16 pixel art.

Investigate only; do not modify any files. User reports first-join roulette and effect HUD don't show even with updated mod installed on client and server, using a new player. Inspect client HUD registration/rendering, Fabric 26.2 rendering behavior, networking and initial/respawn sync, and identify likely root causes with concrete code references and a proposed fix. Report uncertainty and any useful diagnostic questions. Do not implement changes.

Kodari AI
KodariNov 5 at 2:00 am 2

No files modified. I found no definite rendering/API mistake that explains the HUD being absent continuously. The strongest code-level concern is the roulette’s short timer; the respawn sync is also sent at an early lifecycle point.

Verified

  • The HUD draws only when both assignedState and minecraft.player are non-null (PermanentEffectsClient.java:46–50). That state is set only by the custom-payload receiver (:25–35), so a missed or rejected payload suppresses both the roulette and the regular effect label.

  • The Fabric 26.2 HUD API usage is valid. Attaching before VanillaHudElements.HOTBAR inherits the hotbar’s visibility condition, so F1 hides this HUD element. Its position at guiHeight - 50 is above the hotbar’s sprite area; overlap with the hotbar is unlikely. The source confirms centeredText and the HUD callback signatures exist.

  • The server registers the payload type and sends the state at ServerPlayConnectionEvents.JOIN (PermanentEffects.java:105–116). Fabric documents that event as ready to send packets, and the client receiver is global. I found no obvious payload field/order mismatch.

  • The first-assignment flag is true only if the attachment is absent at join (PermanentEffects.java:112). A player reusing an existing UUID with persisted attachment data will not get the roulette, even if they appear new in a particular test.

  • The roulette timer begins as soon as the payload arrives, but rendering waits for minecraft.player (PermanentEffectsClient.java:32–34, 46–50). It runs for about two seconds (:17, 53–61). If the player is not render-ready before it expires, the roulette will be skipped. The normal effect label should still appear afterward, so this alone does not explain both displays remaining absent.

Lifecycle concern

ServerPlayerEvents.COPY_FROM sends state from inside player restoration (PermanentEffects.java:118–128). Fabric invokes that event at the tail of restoreFrom; vanilla has already assigned the replacement player the old connection, but sends the respawn packet afterward. The sources do not guarantee how the client processes that state update relative to its respawn transition. This is a credible risk for respawn refreshes, but it does not explain the initial join by itself.

Likely fix and diagnostics

Start the roulette when the HUD is first eligible to render, rather than when the packet arrives. For respawn, resend authoritative state after the replacement player has been added/respawn handling is underway, rather than relying solely on the COPY_FROM send. For the missing HUD on initial join, add temporary diagnostics at server join/send, client payload receipt (including the valueOf rejection path), and HUD callback entry; those will distinguish a missing packet from a hidden or uninvoked HUD layer.

Useful questions to narrow it down: Was F1 pressed? Does the permanent label appear after waiting several seconds, or never? Does the server send the private death/kill message, and does rerolling change the HUD? Is the “new player” using a UUID that may already have persistent effect data? Were there any client log entries about an unknown/rejected payload or client initializer errors?

Implement requested items and command for existing Fabric 26.2 mod; do not change HUD/roulette. Restore Reroll Potion's original texture from available project history if possible (do not substitute a newly invented texture while claiming it is the original; report if unavailable). Potion Shard: stackable 64, rainbow amethyst-shard-style 16x16 icon, no crafting recipe; when a player kills another player while killer is already at their effect-specific maximum BEFORE kill and victim was above their own effect-specific minimum BEFORE death, drop one shard at victim location; no drop for a victim at minimum, no duplicate credits or non-PvP kills. Right-click consumes one shard only when it successfully raises user's current effect displayed level by one, capped per effect; update persistence, effects, HUD sync, and notify consistently. Register /withdraw shard <positive integer> usable without op: convert the player's accumulated positive displayed effect levels into that many physical shards, lowering their level by that amount; cannot withdraw more than max(0,current displayed level), no changes on failure, privately report exactly "You don't have enough shards for that!"; give items safely handling full inventory (drop overflow), support amounts greater than a stack. Effect Essence: rainbow gunpowder-style icon, craft using enchanted golden apple center, netherite ingots four corners, diamond blocks four edge centers. Right-click consumes one only when it successfully raises level and resulting level is at most 0, never exceeding effect-specific cap (Hero at 0 therefore cannot use it). Ensure both items work for health/hero/ordinary effects respecting all min/max, avoid creative/inventory/side duplication exploits. Add resource definitions and names. Existing progression is in PermanentEffects.java, with death handler and changeLevel; inspect and reuse/refactor authoritative logic. Do not add tests.

Kodari AI
KodariNov 5 at 2:20 am 6
  1. Trace the existing progression, item registration, networking, and recipes; restore the original potion texture only if project history provides it.

  2. Implement shard/essence items and survival recipe with authoritative level-change handling.

  3. Add the non-op /withdraw shard <amount> command with safe inventory overflow handling.

Potion Shard and Effect Essence are registered with server-authoritative, clamped level changes; shard drops check both players’ pre-change levels. The project history contains no recoverable original potion texture, so I left it untouched. Next I’m adding the withdrawal command.

Implemented the requested items and command without changing HUD or roulette code.

  • Potion Shard: Stackable to 64, with a 16×16 rainbow shard icon and no recipe. It raises the current level by one only when that level is below its effect-specific maximum; the server consumes it only on success. A shard drops at the victim’s location when a credited player-killer was already at their maximum before the kill and the victim was above their minimum before death.

  • Effect Essence: Has a rainbow powder icon and a recipe with an enchanted golden apple in the center, netherite ingots in the corners, and diamond blocks on the other four slots. It raises the level only if the result is at most 0 and within the effect cap, so Hero of the Village at 0 cannot use it.

  • /withdraw shard <positive integer>: Available without operator status. It withdraws no more than the player’s positive displayed level, updates the effect and sync, and gives shards in stacks with any inventory overflow dropped. Insufficient balance leaves state unchanged and privately reports exactly: You don't have enough shards for that!

  • Reroll Potion texture: No recoverable original copy was found in the project history or other assets. I left the existing texture untouched rather than replacing it and claiming it was the original. No tests were added.

Complete/check the existing Potion Shard, Effect Essence and Reroll Potion texture work already present. User changed withdrawal requirement: /withdraw shard <amount> must allow converting effect levels into physical shards down into negatives, all the way to the current effect's own minimum (ordinary -5, health -4, hero 0). Available amount = current displayed level minus its effect-specific minimum. Reject excessive amounts atomically with exact message "You don't have enough shards for that!"; non-op accessible, positive integer, safe inventory overflow. Review existing implementation against original request: shard drops on PvP death only when killer was at effect max and victim was above their minimum before death; item use increments up to max, stack 64 and no recipe; essence recipe apple center, netherite corners, diamond blocks edges, use only raises to at most 0; colored rainbow shard/gunpowder icons. Restore original reroll potion texture from project history if available; if not available, report honestly. Ensure authoritative syncing and no duplicate drops. Implement feature code only; no tests.

Kodari AI
KodariNov 6 at 1:54 pm 4
  1. Audit the existing progression, item use, withdrawal, and resource files against the revised minimum-level rules.

  2. Check project history for the original Reroll Potion texture.

  3. Patch only the feature code/resources that are missing or incorrect; add no tests.

  • Withdrawal updated: /withdraw shard <amount> now allows withdrawal down to the current effect’s minimum: ordinary effects −5, Health Boost −4, and Hero of the Village 0. Amounts above current level − minimum fail before state or inventory changes and use the exact requested message. Successful withdrawals go through the existing authoritative level-change path, which refreshes mechanics and syncs the HUD. The command remains usable without op; inventory overflow is dropped safely.

  • Existing behavior checked: Shards are stackable to 64 and have no recipe; shard and essence uses only consume on a successful server-side increase within the effect cap. Essence cannot raise a level above 0, and its recipe has the enchanted golden apple in the center, netherite ingots in the corners, and diamond blocks on the edges. PvP shard drops check both players’ levels before death adjustments; vanilla’s death guard prevents the death callback from repeating for the same death.

  • Textures: Adapted the existing Potion Shard art to a 16×16 icon. The current Reroll Potion texture remains untouched; the project has no accessible Git/history or other copy from which to restore an original, so I can’t verify or restore that historical version.

  • No HUD or roulette changes; no tests added.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
24 826
src/main/java/com/kodari/permanenteffects/PermanentEffects.java
package com.kodari.permanenteffects;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.attachment.v1.AttachmentRegistry;
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents;
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.DamageTypeTags;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.food.FoodData;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;

import java.util.concurrent.ThreadLocalRandom;

public class PermanentEffects implements ModInitializer {
	public static final String MOD_ID = "permanenteffects";
	private static long serverTick;

	public record PlayerEffectState(EffectType effect, int level) {
		private static final Codec<EffectType> EFFECT_CODEC = Codec.STRING.xmap(EffectType::valueOf, type -> type.name());
		public static final Codec<PlayerEffectState> CODEC = RecordCodecBuilder.create(instance -> instance.group(
				EFFECT_CODEC.fieldOf("effect").forGetter(PlayerEffectState::effect),
				Codec.INT.fieldOf("level").forGetter(PlayerEffectState::level)
		).apply(instance, PlayerEffectState::new));
	}

	public enum EffectType {
		HASTE("Haste", MobEffects.HASTE),
		HERO_OF_THE_VILLAGE("Hero of the Village", MobEffects.HERO_OF_THE_VILLAGE),
		STRENGTH("Strength", MobEffects.STRENGTH),
		SPEED("Speed", MobEffects.SPEED),
		LUCK("Luck", MobEffects.LUCK),
		REGENERATION("Regeneration", MobEffects.REGENERATION),
		SATURATION("Saturation", MobEffects.SATURATION),
		FIRE_RESISTANCE("Fire Resistance", MobEffects.FIRE_RESISTANCE),
		DOLPHINS_GRACE("Dolphin's Grace", MobEffects.DOLPHINS_GRACE),
		HEALTH_BOOST("Health Boost", MobEffects.HEALTH_BOOST);

		private final String displayName;
		private final Holder<MobEffect> effect;

		EffectType(String displayName, Holder<MobEffect> effect) {
			this.displayName = displayName;
			this.effect = effect;
		}

		public String displayName() {
			return displayName;
		}

		public int color() {
			return effect.value().getColor();
		}
	}

	public static final AttachmentType<PlayerEffectState> PLAYER_EFFECT_STATE = AttachmentRegistry.create(
			Identifier.fromNamespaceAndPath(MOD_ID, "player_effect_state"),
			builder -> builder.persistent(PlayerEffectState.CODEC).copyOnDeath()
	);

	private static final ResourceKey<Item> REROLL_POTION_KEY = ResourceKey.create(
			Registries.ITEM, Identifier.fromNamespaceAndPath(MOD_ID, "reroll_potion")
	);
	public static final Item REROLL_POTION = Registry.register(
			BuiltInRegistries.ITEM,
			REROLL_POTION_KEY,
			new RerollPotionItem(new Item.Properties().setId(REROLL_POTION_KEY).stacksTo(1))
	);
	private static final ResourceKey<Item> POTION_SHARD_KEY = ResourceKey.create(
			Registries.ITEM, Identifier.fromNamespaceAndPath(MOD_ID, "potion_shard")
	);
	public static final Item POTION_SHARD = Registry.register(
			BuiltInRegistries.ITEM,
			POTION_SHARD_KEY,
			new LevelBoostItem(new Item.Properties().setId(POTION_SHARD_KEY).stacksTo(64), false)
	);
	private static final ResourceKey<Item> EFFECT_ESSENCE_KEY = ResourceKey.create(
			Registries.ITEM, Identifier.fromNamespaceAndPath(MOD_ID, "effect_essence")
	);
	public static final Item EFFECT_ESSENCE = Registry.register(
			BuiltInRegistries.ITEM,
			EFFECT_ESSENCE_KEY,
			new LevelBoostItem(new Item.Properties().setId(EFFECT_ESSENCE_KEY).stacksTo(64), true)
	);

	private static final ResourceKey<CreativeModeTab> TOOLS_AND_UTILITIES = ResourceKey.create(
			Registries.CREATIVE_MODE_TAB, Identifier.fromNamespaceAndPath("minecraft", "tools_and_utilities")
	);
	private static final Identifier HASTE_ATTACK_SPEED = Identifier.fromNamespaceAndPath(MOD_ID, "haste_attack_speed");
	private static final Identifier STRENGTH_DAMAGE = Identifier.fromNamespaceAndPath(MOD_ID, "strength_damage");
	private static final Identifier SPEED_MOVEMENT = Identifier.fromNamespaceAndPath(MOD_ID, "speed_movement");
	private static final Identifier LUCK_VALUE = Identifier.fromNamespaceAndPath(MOD_ID, "luck_value");
	private static final Identifier HEALTH_BOOST_VALUE = Identifier.fromNamespaceAndPath(MOD_ID, "health_boost_value");

	@Override
	public void onInitialize() {
		PayloadTypeRegistry.clientboundPlay().register(EffectStatePayload.TYPE, EffectStatePayload.CODEC);
		WithdrawCommand.register();
		CreativeModeTabEvents.modifyOutputEvent(TOOLS_AND_UTILITIES).register(output -> {
			output.prepend(new ItemStack(REROLL_POTION));
			output.prepend(new ItemStack(POTION_SHARD));
			output.prepend(new ItemStack(EFFECT_ESSENCE));
		});

		ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
			ServerPlayer player = handler.getPlayer();
			boolean firstAssignment = player.getAttached(PLAYER_EFFECT_STATE) == null;
			PlayerEffectState state = ensureState(player);
			refreshMechanics(player, state);
			sendState(player, state, firstAssignment);
		});

		ServerPlayerEvents.COPY_FROM.register((oldPlayer, newPlayer, alive) -> {
			PlayerEffectState state = oldPlayer.getAttached(PLAYER_EFFECT_STATE);
			if (state == null) {
				state = randomState();
			}
			oldPlayer.setAttached(PLAYER_EFFECT_STATE, state);
			newPlayer.setAttached(PLAYER_EFFECT_STATE, state);
			clearMechanics(oldPlayer, state.effect());
			refreshMechanics(newPlayer, state);
			sendState(newPlayer, state);
		});

		ServerLivingEntityEvents.AFTER_DEATH.register((entity, damageSource) -> {
			if (!(entity instanceof ServerPlayer victim)) {
				return;
			}
			PlayerEffectState victimState = ensureState(victim);
			if (damageSource.getEntity() instanceof ServerPlayer killer && !killer.getUUID().equals(victim.getUUID())) {
				PlayerEffectState killerState = ensureState(killer);
				if (killerState.level() >= maximumLevel(killerState.effect())
						&& victimState.level() > minimumLevel(victimState.effect())) {
					ServerLevel serverLevel = victim.level();
					serverLevel.addFreshEntity(new ItemEntity(serverLevel, victim.getX(), victim.getY(), victim.getZ(), new ItemStack(POTION_SHARD)));
				}
			}

			applyLevelChange(victim, adjust(victimState, -1));

			if (damageSource.getEntity() instanceof ServerPlayer killer && !killer.getUUID().equals(victim.getUUID())) {
				changeLevel(killer, 1);
			}
		});

		ServerLivingEntityEvents.ALLOW_DAMAGE.register((entity, source, amount) -> {
			if (!(entity instanceof ServerPlayer player) || !source.is(DamageTypeTags.IS_FIRE)) {
				return true;
			}
			PlayerEffectState state = player.getAttached(PLAYER_EFFECT_STATE);
			if (state == null || state.effect() != EffectType.FIRE_RESISTANCE) {
				return true;
			}
			double resistance = Math.min(1.0, ordinaryStrength(state));
			return ThreadLocalRandom.current().nextDouble() >= resistance;
		});

		ServerTickEvents.END_SERVER_TICK.register(server -> {
			serverTick++;
			for (ServerPlayer player : server.getPlayerList().getPlayers()) {
				if (!player.isAlive()) {
					continue;
				}
				PlayerEffectState state = player.getAttached(PLAYER_EFFECT_STATE);
				if (state != null) {
					tickMechanics(player, state);
				}
			}
		});
	}

	public static double strengthFor(Player player, EffectType effect) {