// Path: src/main/java/net/silentchaos512/scalinghealth/ScalingHealth.java
// @Mod(ScalingHealth.MOD_ID)
// public class ScalingHealth {
//     public static final String MOD_ID = "scalinghealth";
//     public static final String MOD_NAME = "Scaling Health";
//     public static final String VERSION = "2.5.3";
// 
//     public static final Random random = new Random();
// 
//     public static final ItemGroup SH = new ItemGroup(MOD_ID) {
//         @Override
//         public ItemStack createIcon() {
//             return new ItemStack(ModItems.HEART_CRYSTAL.asItem());
//         }
//     };
// 
//     public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
// 
//     public ScalingHealth() {
//         Config.init();
//         Network.init();
//         ModLoot.init();
// 
//         FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
//         FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(GlobalLootModifierSerializer.class, this::registerLootModSerializers);
// 
//         MinecraftForge.EVENT_BUS.addListener(this::serverAboutToStart);
//         MinecraftForge.EVENT_BUS.register(PetEventHandler.INSTANCE);
//         MinecraftForge.EVENT_BUS.register(DamageScaling.INSTANCE);
//     }
// 
//     private void registerLootModSerializers(RegistryEvent.Register<GlobalLootModifierSerializer<?>> event) {
//         event.getRegistry().register(new TableGlobalModifier.Serializer().setRegistryName(getId("table_loot_mod")));
//     }
// 
//     private void commonSetup(FMLCommonSetupEvent event) {
//         DifficultyAffectedCapability.register();
//         DifficultySourceCapability.register();
//         PlayerDataCapability.register();
//         PetHealthCapability.register();
//         DeferredWorkQueue.runLater(SHWorldFeatures::addFeaturesToBiomes);
//     }
// 
//     private void serverAboutToStart(FMLServerAboutToStartEvent event) {
//         ModCommands.registerAll(event.getServer().getCommandManager().getDispatcher());
//     }
// 
//     @Mod.EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
//     public static class ClientForge {
//         static {
//             MinecraftForge.EVENT_BUS.register(HeartDisplayHandler.INSTANCE);
//             MinecraftForge.EVENT_BUS.register(DifficultyMeter.INSTANCE);
// 
//             DebugOverlay.init();
//         }
// 
//         @SubscribeEvent
//         public static void clientSetup(FMLClientSetupEvent event) {
//             KeyManager.registerBindings();
//         }
//     }
// 
//     public static String getVersion() {
//         return getVersion(false);
//     }
// 
//     public static String getVersion(boolean correctInDev) {
//         Optional<? extends ModContainer> o = ModList.get().getModContainerById(MOD_ID);
//         if (o.isPresent()) {
//             String str = o.get().getModInfo().getVersion().toString();
//             if (correctInDev && "NONE".equals(str))
//                 return VERSION;
//             return str;
//         }
//         return "0.0.0";
//     }
// 
//     public static ResourceLocation getId(String path) {
//         return new ResourceLocation(MOD_ID, path);
//     }
// }
// 
// Path: src/main/java/net/silentchaos512/scalinghealth/client/ClientHandler.java
// public final class ClientHandler {
//     private static final Marker MARKER = MarkerManager.getMarker("ClientHandler");
//     // Frequent updates (up to once per second)
//     public static float playerDifficulty;
//     public static float areaDifficulty;
//     public static int regenTimer;
//     public static int locationMultiPercent;
//     // Infrequent updates (join server/world, travel to new dimension)
//     public static AreaDifficultyMode areaMode = AreaDifficultyMode.WEIGHTED_AVERAGE;
//     public static float maxDifficultyValue;
// 
//     private ClientHandler() {}
// 
//     public static void onMessage(ClientSyncMessage msg, Supplier<NetworkEvent.Context> ctx) {
//         ctx.get().enqueueWork(() -> handleSyncMessage(msg));
//         ctx.get().setPacketHandled(true);
//     }
// 
//     private static void handleSyncMessage(ClientSyncMessage msg) {
//         playerDifficulty = msg.playerDifficulty;
//         areaDifficulty = msg.areaDifficulty;
//         regenTimer = msg.regenTimer;
//         locationMultiPercent = msg.locationMultiPercent;
// 
//         Minecraft mc = Minecraft.getInstance();
//         ClientPlayerEntity player = mc.player;
//         if (player != null) {
//             player.experienceLevel = msg.experienceLevel;
//         }
//     }
// 
//     public static void onLoginMessage(ClientLoginMessage msg, Supplier<NetworkEvent.Context> ctx) {
//         ctx.get().enqueueWork(() -> handleLoginMessage(msg));
//         ctx.get().setPacketHandled(true);
//     }
// 
//     private static void handleLoginMessage(ClientLoginMessage msg) {
//         ScalingHealth.LOGGER.info(MARKER, "Processing login packet");
//         areaMode = msg.areaMode;
//         maxDifficultyValue = msg.maxDifficultyValue;
//         ScalingHealth.LOGGER.info(MARKER, "World area mode: {}", areaMode.getDisplayName().getFormattedText());
//         ScalingHealth.LOGGER.info(MARKER, "World max difficulty: {}", maxDifficultyValue);
//     }
// }


import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.network.simple.SimpleChannel;
import net.silentchaos512.scalinghealth.ScalingHealth;
import net.silentchaos512.scalinghealth.client.ClientHandler;
import java.util.Objects;
package net.silentchaos512.scalinghealth.network;



public final class Network {
    private static final ResourceLocation NAME = ScalingHealth.getId("network");

    public static SimpleChannel channel;

    static {
        channel = NetworkRegistry.ChannelBuilder.named(NAME)
// Path: src/main/java/net/silentchaos512/scalinghealth/ScalingHealth.java
// @Mod(ScalingHealth.MOD_ID)
// public class ScalingHealth {
//     public static final String MOD_ID = "scalinghealth";
//     public static final String MOD_NAME = "Scaling Health";
//     public static final String VERSION = "2.5.3";
// 
//     public static final Random random = new Random();
// 
//     public static final ItemGroup SH = new ItemGroup(MOD_ID) {
//         @Override
//         public ItemStack createIcon() {
//             return new ItemStack(ModItems.HEART_CRYSTAL.asItem());
//         }
//     };
// 
//     public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
// 
//     public ScalingHealth() {
//         Config.init();
//         Network.init();
//         ModLoot.init();
// 
//         FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
//         FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(GlobalLootModifierSerializer.class, this::registerLootModSerializers);
// 
//         MinecraftForge.EVENT_BUS.addListener(this::serverAboutToStart);
//         MinecraftForge.EVENT_BUS.register(PetEventHandler.INSTANCE);
//         MinecraftForge.EVENT_BUS.register(DamageScaling.INSTANCE);
//     }
// 
//     private void registerLootModSerializers(RegistryEvent.Register<GlobalLootModifierSerializer<?>> event) {
//         event.getRegistry().register(new TableGlobalModifier.Serializer().setRegistryName(getId("table_loot_mod")));
//     }
// 
//     private void commonSetup(FMLCommonSetupEvent event) {
//         DifficultyAffectedCapability.register();
//         DifficultySourceCapability.register();
//         PlayerDataCapability.register();
//         PetHealthCapability.register();
//         DeferredWorkQueue.runLater(SHWorldFeatures::addFeaturesToBiomes);
//     }
// 
//     private void serverAboutToStart(FMLServerAboutToStartEvent event) {
//         ModCommands.registerAll(event.getServer().getCommandManager().getDispatcher());
//     }
// 
//     @Mod.EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
//     public static class ClientForge {
//         static {
//             MinecraftForge.EVENT_BUS.register(HeartDisplayHandler.INSTANCE);
//             MinecraftForge.EVENT_BUS.register(DifficultyMeter.INSTANCE);
// 
//             DebugOverlay.init();
//         }
// 
//         @SubscribeEvent
//         public static void clientSetup(FMLClientSetupEvent event) {
//             KeyManager.registerBindings();
//         }
//     }
// 
//     public static String getVersion() {
//         return getVersion(false);
//     }
// 
//     public static String getVersion(boolean correctInDev) {
//         Optional<? extends ModContainer> o = ModList.get().getModContainerById(MOD_ID);
//         if (o.isPresent()) {
//             String str = o.get().getModInfo().getVersion().toString();
//             if (correctInDev && "NONE".equals(str))
//                 return VERSION;
//             return str;
//         }
//         return "0.0.0";
//     }
// 
//     public static ResourceLocation getId(String path) {
//         return new ResourceLocation(MOD_ID, path);
//     }
// }
// 
// Path: src/main/java/net/silentchaos512/scalinghealth/client/ClientHandler.java
// public final class ClientHandler {
//     private static final Marker MARKER = MarkerManager.getMarker("ClientHandler");
//     // Frequent updates (up to once per second)
//     public static float playerDifficulty;
//     public static float areaDifficulty;
//     public static int regenTimer;
//     public static int locationMultiPercent;
//     // Infrequent updates (join server/world, travel to new dimension)
//     public static AreaDifficultyMode areaMode = AreaDifficultyMode.WEIGHTED_AVERAGE;
//     public static float maxDifficultyValue;
// 
//     private ClientHandler() {}
// 
//     public static void onMessage(ClientSyncMessage msg, Supplier<NetworkEvent.Context> ctx) {
//         ctx.get().enqueueWork(() -> handleSyncMessage(msg));
//         ctx.get().setPacketHandled(true);
//     }
// 
//     private static void handleSyncMessage(ClientSyncMessage msg) {
//         playerDifficulty = msg.playerDifficulty;
//         areaDifficulty = msg.areaDifficulty;
//         regenTimer = msg.regenTimer;
//         locationMultiPercent = msg.locationMultiPercent;
// 
//         Minecraft mc = Minecraft.getInstance();
//         ClientPlayerEntity player = mc.player;
//         if (player != null) {
//             player.experienceLevel = msg.experienceLevel;
//         }
//     }
// 
//     public static void onLoginMessage(ClientLoginMessage msg, Supplier<NetworkEvent.Context> ctx) {
//         ctx.get().enqueueWork(() -> handleLoginMessage(msg));
//         ctx.get().setPacketHandled(true);
//     }
// 
//     private static void handleLoginMessage(ClientLoginMessage msg) {
//         ScalingHealth.LOGGER.info(MARKER, "Processing login packet");
//         areaMode = msg.areaMode;
//         maxDifficultyValue = msg.maxDifficultyValue;
//         ScalingHealth.LOGGER.info(MARKER, "World area mode: {}", areaMode.getDisplayName().getFormattedText());
//         ScalingHealth.LOGGER.info(MARKER, "World max difficulty: {}", maxDifficultyValue);
//     }
// }


// Path: src/main/java/net/silentchaos512/scalinghealth/network/Network.java
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.network.simple.SimpleChannel;
import net.silentchaos512.scalinghealth.ScalingHealth;
import net.silentchaos512.scalinghealth.client.ClientHandler;
import java.util.Objects;

package net.silentchaos512.scalinghealth.network;



public final class Network {
    private static final ResourceLocation NAME = ScalingHealth.getId("network");

    public static SimpleChannel channel;

    static {
        channel = NetworkRegistry.ChannelBuilder.named(NAME)
                .clientAcceptedVersions(s -> Objects.equals(s, "1"))