<commit_before>/*
 ** 2012 April 30
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **    May you do good and not evil.
 **    May you find forgiveness for yourself and forgive others.
 **    May you share freely, never taking more than you give.
 */
package info.ata4.minecraft.minema.client.engine;

import java.util.List;

import info.ata4.minecraft.minema.util.reflection.PrivateFields;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;

/**
 * EffectRenderer with configurable particle limit.
 * 
 * @author <NAME> <<EMAIL>>
 */
public class ExtendedEffectRenderer extends EffectRenderer {

	// TODO: This is pretty much a very old derivative from original MC code (works though)
	private List<EntityFX>[][] fxLayers;
	private int particleLimit = 4000;

	public ExtendedEffectRenderer(World world, TextureManager textureManager) {
		super(world, textureManager);

		try {
			fxLayers = ReflectionHelper.getPrivateValue(EffectRenderer.class, this,
					PrivateFields.EFFECTRENDERER_FXLAYERS);
		} catch (Exception ex) {
			throw new RuntimeException("Can't get FX layers array", ex);
		}
	}

	@Override
	public void addEffect(EntityFX fx) {
		// Forge: Prevent modders from being bad and adding nulls causing
		// untraceable NPEs.
		if (fx == null) {
			return;
		}

		if (particleLimit == 0) {
			return;
		}

		int i = fx.getFXLayer();
		int k = fx.func_187111_c() ? 0 : 1;

		List<EntityFX> fxLayer = fxLayers[i][k];<commit_msg>1.9 Update: ArrayDeque is the data structure for fxLayers now<commit_after>/*
 ** 2012 April 30
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **    May you do good and not evil.
 **    May you find forgiveness for yourself and forgive others.
 **    May you share freely, never taking more than you give.
 */
package info.ata4.minecraft.minema.client.engine;

import java.util.ArrayDeque;

import info.ata4.minecraft.minema.util.reflection.PrivateFields;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;

/**
 * EffectRenderer with configurable particle limit.
 * 
 * @author <NAME> <barracuda415 at yahoo.de>
 */
public class ExtendedEffectRenderer extends EffectRenderer {

	private final ArrayDeque<EntityFX>[][] fxLayers;
	private int particleLimit = 4000;

	public ExtendedEffectRenderer(World world, TextureManager textureManager) {
		super(world, textureManager);

		try {
			fxLayers = ReflectionHelper.getPrivateValue(EffectRenderer.class, this,
					PrivateFields.EFFECTRENDERER_FXLAYERS);
		} catch (Exception ex) {
			throw new RuntimeException("Can't get FX layers array", ex);
		}
	}

	@Override
	public void addEffect(EntityFX fx) {
		// Forge: Prevent modders from being bad and adding nulls causing
		// untraceable NPEs.
		if (fx == null) {
			return;
		}

		if (particleLimit == 0) {
			return;
		}

		int i = fx.getFXLayer();
		int k = fx.func_187111_c() ? 0 : 1;

		ArrayDeque<EntityFX> fxLayer = fxLayers[i][k];
{'fraction_non_alphanumeric': 0.10140679953106682, 'fraction_numerical': 0.013774912075029308, 'mean_word_length': 4.186930091185411, 'pattern_counts': {'":': 0, '<': 12, '<?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': '4267703', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1044, 'n_words': 312}