<commit_before>package org.cyclops.cyclopscore.block.multi;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import org.cyclops.cyclopscore.algorithm.Dimension;
import org.cyclops.cyclopscore.helper.L10NHelpers;
import org.cyclops.cyclopscore.helper.LocationHelpers;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Detector of cubes in a world.
 * @author rubensworks
 *
 */
public class CubeDetector {
	
	private static Vec3i NULL_SIZE = Vec3i.NULL_VECTOR;
	
	private Collection<AllowedBlock> allowedBlocks = Sets.newHashSet();
	private Map<Block, AllowedBlock> blockInfo = Maps.newHashMap();
	private List<? extends IDetectionListener> listeners;
	private List<ISizeValidator> sizeValidators = Lists.newLinkedList();
	
	private Map<Block, Integer> blockOccurences;

	/**
	 * Make a new instance.
	 * @param allowedBlocks The blocks that are allowed in this cube.
	 * @param listeners Listeners for detections. 
	 */
	public CubeDetector(AllowedBlock[] allowedBlocks, List<? extends IDetectionListener> listeners) {<commit_msg>Fix rare cube detection crash<commit_after>package org.cyclops.cyclopscore.block.multi;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import org.cyclops.cyclopscore.algorithm.Dimension;
import org.cyclops.cyclopscore.helper.L10NHelpers;
import org.cyclops.cyclopscore.helper.LocationHelpers;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Detector of cubes in a world.
 * @author rubensworks
 *
 */
public class CubeDetector {
	
	private static Vec3i NULL_SIZE = Vec3i.NULL_VECTOR;
	
	private Collection<AllowedBlock> allowedBlocks = Sets.newHashSet();
	private Map<Block, AllowedBlock> blockInfo = Maps.newHashMap();
	private List<? extends IDetectionListener> listeners;
	private List<ISizeValidator> sizeValidators = Lists.newLinkedList();
	
	private Map<Block, Integer> blockOccurences = Maps.newHashMap();

	/**
	 * Make a new instance.
	 * @param allowedBlocks The blocks that are allowed in this cube.
	 * @param listeners Listeners for detections. 
	 */
	public CubeDetector(AllowedBlock[] allowedBlocks, List<? extends IDetectionListener> listeners) {
{'fraction_non_alphanumeric': 0.10299488677867057, 'fraction_numerical': 0.003652300949598247, 'mean_word_length': 5.459905660377358, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3109907', 'n_tokens_mistral': 846, 'n_tokens_neox': 830, 'n_words': 197}