<commit_before>package pixlepix.auracascade.block.tile;

import net.minecraft.block.Block;
import net.minecraft.block.BlockGlowstone;
import net.minecraft.block.BlockTorch;
import net.minecraft.nbt.NBTTagCompound;
import pixlepix.auracascade.AuraCascade;
import pixlepix.auracascade.data.CoordTuple;
import pixlepix.auracascade.main.Config;

/**
 * Created by pixlepix on 12/25/14.
 */
public class AuraTilePumpLight extends AuraTilePumpBase {
    boolean hasSearched = false;

    @Override
    protected void readCustomNBT(NBTTagCompound nbt) {
        super.readCustomNBT(nbt);
        hasSearched = nbt.getBoolean("hasSearched");
    }

    @Override
    protected void writeCustomNBT(NBTTagCompound nbt) {
        super.writeCustomNBT(nbt);
        nbt.setBoolean("hasSearched", hasSearched);
    }

    @Override
    public void updateEntity() {
        super.updateEntity();
        if (pumpPower > 0) {
            hasSearched = false;
        }

        if (pumpPower == 0 && (!hasSearched || worldObj.getTotalWorldTime() % 1200 == 0)) {
            for (CoordTuple tuple : new CoordTuple(this).inRange(5)) {
                Block block = tuple.getBlock(worldObj);
                if (block instanceof BlockGlowstone) {
                    addFuel(Config.pumpGlowstoneDuration, Config.pumpGlowstoneSpeed);
                    if (!worldObj.isRemote) {
                        for (int j = 0; j < 5; j++) {
                            AuraCascade.proxy.addBlockDestroyEffects(tuple);
                        }
                    }

                    tuple.setBlockToAir(worldObj);
                    break;
                }
                if (block instanceof BlockTorch) {
                    addFuel(Config.pumpTorchDuration, Config.pumpTorchSpeed);
                    if (!worldObj.isRemote) {
                        for (int j = 0; j < 5; j++) {
                            AuraCascade.proxy.getEffectRenderer().addBlockDestroyEffects(tuple.getX(), tuple.getY(), tuple.getZ(), tuple.getBlock(worldObj), tuple.getMeta(worldObj));
                        }
                    }

                    tuple.setBlockToAir(worldObj);
                    break;
                }
            }<commit_msg>Fixed server crash when using torches and glowstone<commit_after>package pixlepix.auracascade.block.tile;

import net.minecraft.block.Block;
import net.minecraft.block.BlockGlowstone;
import net.minecraft.block.BlockTorch;
import net.minecraft.nbt.NBTTagCompound;
import pixlepix.auracascade.AuraCascade;
import pixlepix.auracascade.data.CoordTuple;
import pixlepix.auracascade.main.Config;

/**
 * Created by pixlepix on 12/25/14.
 */
public class AuraTilePumpLight extends AuraTilePumpBase {
    boolean hasSearched = false;

    @Override
    protected void readCustomNBT(NBTTagCompound nbt) {
        super.readCustomNBT(nbt);
        hasSearched = nbt.getBoolean("hasSearched");
    }

    @Override
    protected void writeCustomNBT(NBTTagCompound nbt) {
        super.writeCustomNBT(nbt);
        nbt.setBoolean("hasSearched", hasSearched);
    }

    @Override
    public void updateEntity() {
        super.updateEntity();
        if (pumpPower > 0) {
            hasSearched = false;
        }

        if (pumpPower == 0 && (!hasSearched || worldObj.getTotalWorldTime() % 1200 == 0)) {
            for (CoordTuple tuple : new CoordTuple(this).inRange(5)) {
                Block block = tuple.getBlock(worldObj);
                if (block instanceof BlockGlowstone) {
                    addFuel(Config.pumpGlowstoneDuration, Config.pumpGlowstoneSpeed);
                    if (!worldObj.isRemote) {
                        for (int j = 0; j < 5; j++) {
                            AuraCascade.proxy.addBlockDestroyEffects(tuple);
                        }
                    }

                    tuple.setBlockToAir(worldObj);
                    break;
                }
                if (block instanceof BlockTorch) {
                    addFuel(Config.pumpTorchDuration, Config.pumpTorchSpeed);
                    if (!worldObj.isRemote) {
                        for (int j = 0; j < 5; j++) {
                            AuraCascade.proxy.addBlockDestroyEffects(tuple);
                        }
                    }

                    tuple.setBlockToAir(worldObj);
                    break;
                }
            }
{'fraction_non_alphanumeric': 0.09565217391304348, 'fraction_numerical': 0.008237986270022883, 'mean_word_length': 1.798335467349552, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5937054', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1223, 'n_words': 223}