<commit_before>package totemic_commons.pokefenn.event;

import baubles.api.BaublesApi;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemSword;
import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import totemic_commons.pokefenn.ModItems;
import totemic_commons.pokefenn.Totemic;
import totemic_commons.pokefenn.misc.TotemicDamageSource;
import totemic_commons.pokefenn.util.TotemUtil;

import java.util.Random;

/**
 * Created by Pokefenn.
 * Licensed under MIT (If this is one of my Mods)
 */
public class EntityHurt
{

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void onEntityHurt(LivingHurtEvent event)
    {
        Entity sourceDamageEntity = event.source.getSourceOfDamage();

        Random random = new Random();

        if(event.entityLiving instanceof EntityPlayer && sourceDamageEntity != null)
        {
            if(random.nextInt(3) == 1)
                if(TotemUtil.getArmourAmounts((EntityPlayer) event.entityLiving) == 4)
                    sourceDamageEntity.attackEntityFrom(DamageSource.generic, event.ammount % 2);
        }

        if(event.entity != null && event.source != TotemicDamageSource.vigor && event.entityLiving != null && sourceDamageEntity != null && sourceDamageEntity instanceof EntityPlayer && Totemic.baublesLoaded)
        {
            IInventory baubleInventory = BaublesApi.getBaubles((EntityPlayer) sourceDamageEntity);

            if(baubleInventory.getStackInSlot(0) != null)
            {
                if(baubleInventory.getStackInSlot(0).getItem() == ModItems.baubleArmourDamage)
                {
                    EntityPlayer player = (EntityPlayer) sourceDamageEntity;

                    if(player.getHeldItem().getItem() instanceof ItemSword)
                    {
                        ItemSword item = (ItemSword) player.getHeldItem().getItem();

                        int armour = player.getTotalArmorValue();
                        float damage = item.func_150931_i();
                        float totalDamage = event.ammount;
                        int totemArmour = TotemUtil.getArmourAmounts(player);

                        if(totemArmour == 0 && armour > 5)
                        {
                            totalDamage -= 2;
                        }
                        if(totemArmour == 0)
                        {
                            totalDamage -= 1;
                        }
                        if(totemArmour > 0)
                        {
                            totalDamage += totemArmour == 4 ? 2 : 1;
                        }
                        if(damage > 4)
                        {
                            totalDamage -= 2;
                        }
                        if(armour == 0)
                        {
                            totalDamage += 1;
                        }
                        if(armour > 0 && armour < 5 && totemArmour == 0)
                        {
                            damage += (armour % 4);
                        }
                        if(damage <= 4)
                        {
                            totalDamage += 1;
                        }
                        event.setResult(Event.Result.DENY);

                        System.out.println(totalDamage);

                        event.entity.attackEntityFrom(TotemicDamageSource.vigor, totalDamage);
                    }
                }
            }
        }
    }

}<commit_msg>Derpity derp<commit_after>package totemic_commons.pokefenn.event;

import baubles.api.BaublesApi;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemSword;
import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import totemic_commons.pokefenn.ModItems;
import totemic_commons.pokefenn.Totemic;
import totemic_commons.pokefenn.misc.TotemicDamageSource;
import totemic_commons.pokefenn.util.TotemUtil;

import java.util.Random;

/**
 * Created by Pokefenn.
 * Licensed under MIT (If this is one of my Mods)
 */
public class EntityHurt
{

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void onEntityHurt(LivingHurtEvent event)
    {
        Entity sourceDamageEntity = event.source.getSourceOfDamage();

        Random random = new Random();

        if(event.entityLiving instanceof EntityPlayer && sourceDamageEntity != null)
        {
            if(random.nextInt(3) == 1)
                if(TotemUtil.getArmourAmounts((EntityPlayer) event.entityLiving) == 4)
                    sourceDamageEntity.attackEntityFrom(DamageSource.generic, event.ammount % 2);
        }

        if(event.entity != null && event.source != TotemicDamageSource.vigor && event.entityLiving != null && sourceDamageEntity != null && sourceDamageEntity instanceof EntityPlayer && Totemic.baublesLoaded)
        {
            IInventory baubleInventory = BaublesApi.getBaubles((EntityPlayer) sourceDamageEntity);

            if(baubleInventory.getStackInSlot(0) != null)
            {
                if(baubleInventory.getStackInSlot(0).getItem() == ModItems.baubleArmourDamage)
                {
                    EntityPlayer player = (EntityPlayer) sourceDamageEntity;

                    if(player.getHeldItem().getItem() instanceof ItemSword)
                    {
                        ItemSword item = (ItemSword) player.getHeldItem().getItem();

                        int armour = player.getTotalArmorValue();
                        float damage = item.func_150931_i();
                        float totalDamage = event.ammount;
                        int totemArmour = TotemUtil.getArmourAmounts(player);

                        if(totemArmour == 0 && armour > 5)
                        {
                            totalDamage -= 2;
                        }
                        if(totemArmour == 0)
                        {
                            totalDamage -= 1;
                        }
                        if(totemArmour > 0)
                        {
                            totalDamage += totemArmour == 4 ? 2 : 1;
                        }
                        if(damage > 4)
                        {
                            totalDamage -= 2;
                        }
                        if(armour == 0)
                        {
                            totalDamage += 1;
                        }
                        if(damage <= 4)
                        {
                            totalDamage += 1;
                        }
                        event.setResult(Event.Result.DENY);
                        
                        event.entity.attackEntityFrom(TotemicDamageSource.vigor, totalDamage);
                    }
                }
            }
        }
    }

}
{'fraction_non_alphanumeric': 0.08655943293347873, 'fraction_numerical': 0.007906215921483098, 'mean_word_length': 1.4670477471418963, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, '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': '1888213', 'n_tokens_mistral': 2058, 'n_tokens_neox': 1885, 'n_words': 309}