<commit_before>package T145.magistics.tiles;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import thaumcraft.common.lib.network.PacketHandler;
import thaumcraft.common.lib.network.fx.PacketFXBlockZap;
import thaumcraft.common.tiles.TileEldritchObelisk;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class TileInfuserDark extends TileInfuser {
	private TileEldritchObelisk obelisk = null;
	private boolean nearObelisk = false;
	private int sparkDelay = 40;

	@Override
	public boolean isDark() {
		return true;
	}

	@Override
	public void readCustomNBT(NBTTagCompound tag) {
		nearObelisk = tag.getBoolean("nearObelisk");
	}

	@Override
	public void writeCustomNBT(NBTTagCompound tag) {
		tag.setBoolean("nearObelisk", nearObelisk);
	}

	@SideOnly(Side.CLIENT)
	public int getDarkCookProgressScaled(int time) {
		return 0;
	}

	@Override
	public void updateEntity() {
		if (nearObelisk) {
			super.updateEntity();

			if (sparkDelay <= 0) {
				PacketHandler.INSTANCE.sendToAllAround(new PacketFXBlockZap(obelisk.xCoord + 0.5F, obelisk.yCoord + 0.5F, obelisk.zCoord + 0.5F, xCoord + 0.5F, yCoord + 0.5F, zCoord + 0.5F), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 32.0D));
				sparkDelay = 80;
			} else {
				--sparkDelay;
			}
		} else {
			int range = 6;

			for (int x = -range; x <= range; ++x) {
				for (int y = -range; y <= range; ++y) {
					for (int z = -range; z <= range; ++z) {
						TileEntity tile = worldObj.getTileEntity(xCoord + x, yCoord + y, zCoord + z);

						if (tile != null && tile instanceof TileEldritchObelisk) {
							obelisk = (TileEldritchObelisk) tile;
							nearObelisk = true;
							return;
						}
					}
				}
			}

			obelisk = null;<commit_msg>Fixed obelisk handling for the dark infuser<commit_after>package T145.magistics.tiles;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import thaumcraft.common.lib.network.PacketHandler;
import thaumcraft.common.lib.network.fx.PacketFXBlockZap;
import thaumcraft.common.tiles.TileEldritchObelisk;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class TileInfuserDark extends TileInfuser {
	protected int[] obeliskQuards = new int[3];
	private boolean nearObelisk = false;
	private int sparkDelay = 40;

	@Override
	public boolean isDark() {
		return true;
	}

	@Override
	public void readCustomNBT(NBTTagCompound tag) {
		super.readCustomNBT(tag);
		obeliskQuards = tag.getIntArray("obeliskQuards");
		nearObelisk = tag.getBoolean("nearObelisk");
	}

	@Override
	public void writeCustomNBT(NBTTagCompound tag) {
		super.writeCustomNBT(tag);
		tag.setIntArray("obeliskQuards", obeliskQuards);
		tag.setBoolean("nearObelisk", nearObelisk);
	}

	@SideOnly(Side.CLIENT)
	public int getDarkCookProgressScaled(int time) {
		return 0;
	}

	@Override
	public void updateEntity() {
		if (nearObelisk) {
			super.updateEntity();

			if (sparkDelay <= 0) {
				PacketHandler.INSTANCE.sendToAllAround(new PacketFXBlockZap(obeliskQuards[0] + 0.5F, obeliskQuards[1] + 0.5F, obeliskQuards[2] + 0.5F, xCoord + 0.5F, yCoord + 0.5F, zCoord + 0.5F), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 32.0D));
				sparkDelay = 80;
			} else {
				--sparkDelay;
			}
		} else {
			int range = 6;

			for (int x = -range; x <= range; ++x) {
				for (int y = -range; y <= range; ++y) {
					for (int z = -range; z <= range; ++z) {
						int xx = xCoord + x;
						int yy = yCoord + y;
						int zz = zCoord + z;
						TileEntity tile = worldObj.getTileEntity(xx, yy, zz);

						if (tile != null && tile instanceof TileEldritchObelisk) {
							obeliskQuards[0] = xx;
							obeliskQuards[1] = yy;
							obeliskQuards[2] = zz;
							nearObelisk = true;
							return;
						}
					}
				}
			}

{'fraction_non_alphanumeric': 0.12034025519139355, 'fraction_numerical': 0.01426069552164123, 'mean_word_length': 3.7765830346475506, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6643534', 'n_tokens_mistral': 1737, 'n_tokens_neox': 1483, 'n_words': 306}