<commit_before>package andrew.powersuits.tick;

import andrew.powersuits.common.AddonUtils;
import andrew.powersuits.modules.AutoFeederModule;
import andrew.powersuits.modules.ClockModule;
import andrew.powersuits.modules.CompassModule;
import andrew.powersuits.modules.TorchPlacerModule;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.item.ItemPowerArmorHelmet;
import net.machinemuse.powersuits.item.ItemPowerFist;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.MuseStringUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import java.util.ArrayList;
import java.util.EnumSet;

public class RenderTickHandler implements ITickHandler {

    static double yBaseIcon;
    static int yBaseString;
    static {
        if (Config.useGraphicalMeters()) {
            yBaseIcon = -1.0;
            yBaseString = 4;
        }
        else {
            yBaseIcon = 17.0;
            yBaseString = 23;
        }
    }
    double yOffsetIcon = 16.0;
    int yOffsetString = 18;

    ArrayList<String> modules;

    ItemStack food = new ItemStack(Item.beefCooked);
    ItemStack torch = new ItemStack(Block.torchWood);
    ItemStack clock = new ItemStack(Item.pocketSundial);
    ItemStack compass = new ItemStack(Item.compass);

    @Override
    public void tickStart(EnumSet<TickType> type, Object... tickData) {}

    @Override
    public void tickEnd(EnumSet<TickType> type, Object... tickData) {
        EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
        modules = new ArrayList<String>();
        findInstalledModules(player);
        for (int i = 0; i < modules.size(); i++) {
            if (modules.get(i).equals(AutoFeederModule.MODULE_AUTO_FEEDER)) {
                int foodLevel = (int) AddonUtils.getFoodLevel(player.getCurrentArmor(3));
                String num = MuseStringUtils.formatNumberShort(foodLevel);
                if (i == 0) {
                    MuseRenderer.drawString(num, 17, yBaseString);
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon, food);
                } else {
                    MuseRenderer.drawString(num, 17, yBaseString + (yOffsetString*i));
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon*i), food);
                }
            } else if (modules.get(i).equals(TorchPlacerModule.MODULE_TORCH_PLACER)) {
                int torchLevel = AddonUtils.getTorchLevel(player.getCurrentEquippedItem());
                int maxTorchLevel = (int) ModuleManager.computeModularProperty(player.getCurrentEquippedItem(), TorchPlacerModule.MAX_TORCH_STORAGE);
                String num = MuseStringUtils.formatNumberShort(torchLevel) + "/" + MuseStringUtils.formatNumberShort(maxTorchLevel);
                if (i == 0) {
                    MuseRenderer.drawString(num, 17, yBaseString);
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon, torch);
                } else {
                    MuseRenderer.drawString(num, 17, yBaseString + (yOffsetString*i));
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon*i), torch);
                }
            } else if (modules.get(i).equals(ClockModule.MODULE_CLOCK)) {
                if (i == 0) {
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon, clock);
                } else {
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon*i), clock);
                }
            } else if (modules.get(i).equals(CompassModule.MODULE_COMPASS)) {
                if (i == 0) {
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon, compass);
                } else {
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon*i), compass);
                }
            }
        }
    }

    public void findInstalledModules(EntityClientPlayerMP player) {
        if (player != null) {
            ItemStack tool = player.getCurrentEquippedItem();
            if (tool != null && tool.getItem() instanceof ItemPowerFist) {<commit_msg>Added and hour and AM/PM string to the clock HUD module.<commit_after>package andrew.powersuits.tick;

import andrew.powersuits.common.AddonUtils;
import andrew.powersuits.modules.AutoFeederModule;
import andrew.powersuits.modules.ClockModule;
import andrew.powersuits.modules.CompassModule;
import andrew.powersuits.modules.TorchPlacerModule;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.item.ItemPowerArmorHelmet;
import net.machinemuse.powersuits.item.ItemPowerFist;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.MuseStringUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import java.util.ArrayList;
import java.util.EnumSet;

public class RenderTickHandler implements ITickHandler {

    static double yBaseIcon;
    static int yBaseString;
    static {
        if (Config.useGraphicalMeters()) {
            yBaseIcon = -1.0;
            yBaseString = 4;
        }
        else {
            yBaseIcon = 17.0;
            yBaseString = 23;
        }
    }
    double yOffsetIcon = 16.0;
    int yOffsetString = 18;
    String ampm = "";

    ArrayList<String> modules;

    ItemStack food = new ItemStack(Item.beefCooked);
    ItemStack torch = new ItemStack(Block.torchWood);
    ItemStack clock = new ItemStack(Item.pocketSundial);
    ItemStack compass = new ItemStack(Item.compass);

    @Override
    public void tickStart(EnumSet<TickType> type, Object... tickData) {}

    @Override
    public void tickEnd(EnumSet<TickType> type, Object... tickData) {
        EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
        modules = new ArrayList<String>();
        findInstalledModules(player);
        for (int i = 0; i < modules.size(); i++) {
            if (modules.get(i).equals(AutoFeederModule.MODULE_AUTO_FEEDER)) {
                int foodLevel = (int) AddonUtils.getFoodLevel(player.getCurrentArmor(3));
                String num = MuseStringUtils.formatNumberShort(foodLevel);
                if (i == 0) {
                    MuseRenderer.drawString(num, 17, yBaseString);
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon, food);
                } else {
                    MuseRenderer.drawString(num, 17, yBaseString + (yOffsetString*i));
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon*i), food);
                }
            } else if (modules.get(i).equals(TorchPlacerModule.MODULE_TORCH_PLACER)) {
                int torchLevel = AddonUtils.getTorchLevel(player.getCurrentEquippedItem());
                int maxTorchLevel = (int) ModuleManager.computeModularProperty(player.getCurrentEquippedItem(), TorchPlacerModule.MAX_TORCH_STORAGE);
                String num = MuseStringUtils.formatNumberShort(torchLevel) + "/" + MuseStringUtils.formatNumberShort(maxTorchLevel);
                if (i == 0) {
                    MuseRenderer.drawString(num, 17, yBaseString);
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon, torch);
                } else {
                    MuseRenderer.drawString(num, 17, yBaseString + (yOffsetString*i));
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon*i), torch);
                }
            } else if (modules.get(i).equals(ClockModule.MODULE_CLOCK)) {
                long time = player.worldObj.provider.getWorldTime();
                int hour = (int)(time/1000);
                if (hour < 6) {
                    hour += 6;
                    ampm = " AM";
                } else if (hour == 6) {
                    hour = 12;
                    ampm = " PM";
                } else if (hour > 6 && hour < 18) {
                    hour -= 6;
                    ampm = " PM";
                } else if (hour == 18) {
                    hour = 12;
                    ampm = " AM";
                } else {
                    hour -= 18;
                    ampm = " AM";
                }
                if (i == 0) {
                    MuseRenderer.drawString(hour + ampm, 17, yBaseString);
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon, clock);
                } else {
                    MuseRenderer.drawString(hour + ampm, 17, yBaseString + (yOffsetString*i));
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon*i), clock);
                }
            } else if (modules.get(i).equals(CompassModule.MODULE_COMPASS)) {
                if (i == 0) {
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon, compass);
                } else {
                    MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon*i), compass);
                }
            }
        }
    }

    public void findInstalledModules(EntityClientPlayerMP player) {
        if (player != null) {
            ItemStack tool = player.getCurrentEquippedItem();
            if (tool != null && tool.getItem() instanceof ItemPowerFist) {
{'fraction_non_alphanumeric': 0.10566983397723713, 'fraction_numerical': 0.011381434687271588, 'mean_word_length': 2.2314439946018894, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '978922', 'n_tokens_mistral': 2898, 'n_tokens_neox': 2769, 'n_words': 511}