<commit_before>package daxum.temporalconvergence.tileentity;

import daxum.temporalconvergence.power.PowerDimension;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;

public class TileDimContr extends TileEntity {
	protected int linkId = -1;
	protected boolean didThisFreeze = false;

	public void freezeDim() {
		if (world.isRemote || didThisFreeze) return;

		PowerDimension connected = PowerDimension.get(world, linkId);

		if (connected != null) {
			connected.addFreezer();
			didThisFreeze = true;
			world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
		}
	}

	public void unFreezeDim() {
		if (!world.isRemote) {
			PowerDimension connected = PowerDimension.get(world, linkId);

			if (connected != null && didThisFreeze) {
				connected.removeFreezer();
				didThisFreeze = false;
				world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
			}
		}
	}

	public void setId(int i) {
		if (!world.isRemote && i != linkId && i >= 0) {
			if (didThisFreeze) {
				PowerDimension old = PowerDimension.get(world, linkId);

				if (old != null)
					old.removeFreezer();

				linkId = i;

				PowerDimension current = PowerDimension.get(world, linkId);

				if (current != null)
					current.addFreezer();
			}
			else {
				linkId = i;
			}

			world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
		}
	}

	@Override
	public NBTTagCompound writeToNBT(NBTTagCompound comp) {
		if (linkId >= 0) //Negative id's are invalid<commit_msg>Fixed powered unset controllers not freezing when set<commit_after>package daxum.temporalconvergence.tileentity;

import daxum.temporalconvergence.power.PowerDimension;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;

public class TileDimContr extends TileEntity {
	protected int linkId = -1;
	protected boolean didThisFreeze = false;

	public void freezeDim() {
		if (world.isRemote || didThisFreeze) return;

		PowerDimension connected = PowerDimension.get(world, linkId);

		if (connected != null)
			connected.addFreezer();

		didThisFreeze = true;
		world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
	}

	public void unFreezeDim() {
		if (!world.isRemote) {
			PowerDimension connected = PowerDimension.get(world, linkId);

			if (connected != null && didThisFreeze) {
				connected.removeFreezer();
				didThisFreeze = false;
				world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
			}
		}
	}

	public void setId(int i) {
		if (!world.isRemote && i != linkId && i >= 0) {
			if (didThisFreeze) {
				PowerDimension old = PowerDimension.get(world, linkId);

				if (old != null)
					old.removeFreezer();

				linkId = i;

				PowerDimension current = PowerDimension.get(world, linkId);

				if (current != null)
					current.addFreezer();
			}
			else {
				linkId = i;
			}

			world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
		}
	}

	public int getId() {
		return linkId;
	}

	@Override
	public NBTTagCompound writeToNBT(NBTTagCompound comp) {
		if (linkId >= 0) //Negative id's are invalid
{'fraction_non_alphanumeric': 0.11639439906651108, 'fraction_numerical': 0.003500583430571762, 'mean_word_length': 4.267281105990784, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6036308', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1113, 'n_words': 241}