<commit_before>package com.lothrazar.event;

import com.lothrazar.samscontent.ModLoader;
import com.lothrazar.util.SamsUtilities;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class HandlerTorchCollide 
{ 
	@SubscribeEvent
	public void onLivingUpdate(LivingUpdateEvent event)
	{
		if(ModLoader.configSettings.fragileTorches == false) { return; }
		
		if(event.entityLiving == null){return;}//it could be an entity thats not living
		
		if(event.entityLiving instanceof EntityPlayer)
		{
			EntityPlayer p = (EntityPlayer)event.entityLiving;
			if(p.isSneaking())
			{
				return;//torches are safe from breaking
			}
		}
		
		if(event.entityLiving.worldObj.getBlockState(event.entityLiving.getPosition()).getBlock() == Blocks.torch
				&& event.entityLiving.worldObj.rand.nextDouble() < 0.1
				&& event.entityLiving.worldObj.isRemote == false)
		{
  
			event.entityLiving.worldObj.setBlockToAir(event.entityLiving.getPosition());
			
			SamsUtilities.dropItemStackInWorld(event.entityLiving.worldObj, event.entityLiving.getPosition(), Blocks.torch);

			SamsUtilities.playSoundAt(event.entityLiving, "random.wood_click"); 
		  
		}
	}<commit_msg>torch handler: instead use existing destroyBlock  function<commit_after>package com.lothrazar.event;

import com.lothrazar.samscontent.ModLoader;
import com.lothrazar.util.SamsUtilities;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class HandlerTorchCollide 
{ 
	@SubscribeEvent
	public void onLivingUpdate(LivingUpdateEvent event)
	{
		if(ModLoader.configSettings.fragileTorches == false) { return; }
		
		if(event.entityLiving == null){return;}//it could be an entity thats not living
		
		if(event.entityLiving instanceof EntityPlayer)
		{
			EntityPlayer p = (EntityPlayer)event.entityLiving;
			if(p.isSneaking())
			{
				return;//torches are safe from breaking
			}
		}
		
		if(event.entityLiving.worldObj.getBlockState(event.entityLiving.getPosition()).getBlock() == Blocks.torch
				&& event.entityLiving.worldObj.rand.nextDouble() < 0.1
				&& event.entityLiving.worldObj.isRemote == false)
		{
  
			event.entityLiving.worldObj.destroyBlock(event.entityLiving.getPosition(), true);  
		}
	}
{'fraction_non_alphanumeric': 0.10996835443037975, 'fraction_numerical': 0.0015822784810126582, 'mean_word_length': 4.964622641509434, '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': '934557', 'n_tokens_mistral': 899, 'n_tokens_neox': 786, 'n_words': 118}