@Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
   Boolean value = redstoneOut.getValue();
   tagCompound.setBoolean("rs", value == null ? false : value);
   tagCompound.setBoolean("prevIn", prevIn);
 }
  @Override
  protected void checkStateServer() {
    super.checkStateServer();

    int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
    boolean newvalue = BlockTools.getRedstoneSignalIn(meta);
    boolean pulse = newvalue && !prevIn;
    prevIn = newvalue;

    boolean newout = false;

    if (pulse) {
      current++;
      if (current >= counter) {
        current = 0;
        newout = true;
      }

      markDirty();

      if (newout != redstoneOut.getValue()) {
        redstoneOut.setValue(newout);
        notifyBlockUpdate();
      }
    }
  }
 @Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
   tagCompound.setBoolean("powerOn", powerOn);
   tagCompound.setBoolean("connected", connected);
   tagCompound.setInteger("rfPerTick", totalRfPerTick);
 }
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
   powerOn = tagCompound.getBoolean("powerOn");
   connected = tagCompound.getBoolean("connected");
   totalRfPerTick = tagCompound.getInteger("rfPerTick");
 }
 @Override
 public void writeRestorableToNBT(NBTTagCompound tagCompound) {
   super.writeRestorableToNBT(tagCompound);
   writeBufferToNBT(tagCompound);
   tagCompound.setBoolean("large", large);
   tagCompound.setBoolean("transparent", transparent);
   tagCompound.setInteger("color", color);
 }
 @Override
 public void readRestorableFromNBT(NBTTagCompound tagCompound) {
   super.readRestorableFromNBT(tagCompound);
   readBufferFromNBT(tagCompound);
   large = tagCompound.getBoolean("large");
   transparent = tagCompound.getBoolean("transparent");
   color = tagCompound.getInteger("color");
 }
 @Override
 public void readRestorableFromNBT(NBTTagCompound tagCompound) {
   super.readRestorableFromNBT(tagCompound);
   counter = tagCompound.getInteger("counter");
   if (counter == 0) {
     counter = 1;
   }
   current = tagCompound.getInteger("current");
 }
 @Override
 public void writeRestorableToNBT(NBTTagCompound tagCompound) {
   super.writeRestorableToNBT(tagCompound);
   tagCompound.setFloat("strength", strength);
   tagCompound.setFloat("power", power);
   tagCompound.setFloat("efficiency", efficiency);
   tagCompound.setFloat("purity", purity);
   tagCompound.setBoolean("glowing", glowing);
   tagCompound.setByte("version", (byte) 2); // Legacy support to support older crystals.
 }
 @Override
 public void readRestorableFromNBT(NBTTagCompound tagCompound) {
   super.readRestorableFromNBT(tagCompound);
   strength = tagCompound.getFloat("strength");
   power = tagCompound.getFloat("power");
   efficiency = tagCompound.getFloat("efficiency");
   purity = tagCompound.getFloat("purity");
   glowing = tagCompound.getBoolean("glowing");
   byte version = tagCompound.getByte("version");
   if (version < (byte) 2) {
     // We have to convert the power.
     power *= 20.0f;
   }
 }
 @Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
 }
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
 }
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
   redstoneOut.setValue(tagCompound.getBoolean("rs"));
   prevIn = tagCompound.getBoolean("prevIn");
 }
 @Override
 public void writeRestorableToNBT(NBTTagCompound tagCompound) {
   super.writeRestorableToNBT(tagCompound);
   tagCompound.setInteger("counter", counter);
   tagCompound.setInteger("current", current);
 }