<commit_before>package com.hockeyhurd.handler;

import java.util.Random;

import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;

import com.hockeyhurd.mod.ExtraTools;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class EventHookContainer {

	private final Item helm = ExtraTools.glowHelmet;
	private final Item chest = ExtraTools.glowChestplate;
	private final Item leg = ExtraTools.glowLegging;
	private final Item boot = ExtraTools.glowBoot;

	private boolean bootCheck = false;
	private boolean legCheck = false;
	private boolean chestCheck = false;
	private boolean helmCheck = false;
	private boolean canFly = false;

	public EventHookContainer() {
	}

	private void setAllowedFly(boolean canFly) {
		this.canFly = canFly;
	}

	private boolean getAllowedFly() {
		return this.canFly;
	}

	@SubscribeEvent
	public void onOreBreak(BreakEvent event) {

		if (event.block == ExtraTools.glowOre) {
			World world = event.getPlayer().worldObj;
			Random random = new Random();
			int chance = 15;

			int val = 1 + random.nextInt(99);
			if (val <= chance) world.spawnEntityInWorld(new EntityItem(world, (double) event.x, (double) event.y, (double) event.z, new ItemStack(ExtraTools.glowDust)));
		}

		else return;
	}

	@SubscribeEvent
	public void onPlayerUpdate(LivingUpdateEvent event) {

		if (!(event.entityLiving instanceof EntityPlayer)) return;
		else {
			EntityPlayer player = (EntityPlayer) event.entityLiving;

			Item currentHelm = null;
			Item currentChest = null;
			Item currentLeg = null;
			Item currentBoot = null;

			if (player.getCurrentArmor(0) != null) {
				currentBoot = player.getCurrentArmor(0).getItem();
			}

			if (player.getCurrentArmor(1) != null) {
				currentLeg = player.getCurrentArmor(1).getItem();
			}

			if (player.getCurrentArmor(2) != null) {
				currentChest = player.getCurrentArmor(2).getItem();
			}

			if (player.getCurrentArmor(3) != null) {
				currentHelm = player.getCurrentArmor(3).getItem();
			}

			/*<commit_msg>- Fix for broken creative mod flying <commit_after>package com.hockeyhurd.handler;

import java.util.Random;

import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;

import com.hockeyhurd.mod.ExtraTools;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class EventHookContainer {

	private final Item helm = ExtraTools.glowHelmet;
	private final Item chest = ExtraTools.glowChestplate;
	private final Item leg = ExtraTools.glowLegging;
	private final Item boot = ExtraTools.glowBoot;

	private boolean bootCheck = false;
	private boolean legCheck = false;
	private boolean chestCheck = false;
	private boolean helmCheck = false;
	private boolean canFly = false;

	public EventHookContainer() {
	}

	private void setAllowedFly(boolean canFly) {
		this.canFly = canFly;
	}

	private boolean getAllowedFly() {
		return this.canFly;
	}

	@SubscribeEvent
	public void onOreBreak(BreakEvent event) {

		if (event.block == ExtraTools.glowOre) {
			World world = event.getPlayer().worldObj;
			Random random = new Random();
			int chance = 15;

			int val = 1 + random.nextInt(99);
			if (val <= chance) world.spawnEntityInWorld(new EntityItem(world, (double) event.x, (double) event.y, (double) event.z, new ItemStack(ExtraTools.glowDust)));
		}

		else return;
	}

	@SubscribeEvent
	public void onPlayerUpdate(LivingUpdateEvent event) {

		if (!(event.entityLiving instanceof EntityPlayer)) return;
		else {
			EntityPlayer player = (EntityPlayer) event.entityLiving;
			if (player.capabilities.isCreativeMode) return;

			Item currentHelm = null;
			Item currentChest = null;
			Item currentLeg = null;
			Item currentBoot = null;

			if (player.getCurrentArmor(0) != null) {
				currentBoot = player.getCurrentArmor(0).getItem();
			}

			if (player.getCurrentArmor(1) != null) {
				currentLeg = player.getCurrentArmor(1).getItem();
			}

			if (player.getCurrentArmor(2) != null) {
				currentChest = player.getCurrentArmor(2).getItem();
			}

			if (player.getCurrentArmor(3) != null) {
				currentHelm = player.getCurrentArmor(3).getItem();
			}

			/*
{'fraction_non_alphanumeric': 0.10764525993883792, 'fraction_numerical': 0.005300713557594291, 'mean_word_length': 4.594070695553022, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3217322', 'n_tokens_mistral': 1705, 'n_tokens_neox': 1551, 'n_words': 346}