<commit_before>package oe.block.tile;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import oe.api.OETileInterface;
import oe.api.OE_API;
import oe.api.lib.OEType;
import oe.helper.ConfigHelper;
import cpw.mods.fml.common.network.PacketDispatcher;

public class TileExperienceConsumer extends TileEntity implements OETileInterface {
  public double stored;
  public int factor;
  
  public TileExperienceConsumer() {
    super();
    ConfigHelper.load();
    factor = ConfigHelper.other("QMC", "XP to QMC Factor", 10);
    ConfigHelper.save();
  }
  
  @Override
  public void onInventoryChanged() {
    sendChangeToClients();
  }
  
  @Override
  public void updateEntity() {
    double pStored = stored;
    stored = OE_API.provide(xCoord, yCoord, zCoord, worldObj, stored);
    if (pStored != stored) {
      onInventoryChanged();
    }
  }
  
  @Override
  public void readFromNBT(NBTTagCompound TagCompound) {
    super.readFromNBT(TagCompound);
    stored = TagCompound.getDouble("OE_Stored_Value");
  }
  
  @Override
  public void writeToNBT(NBTTagCompound TagCompound) {
    super.writeToNBT(TagCompound);
    TagCompound.setDouble("OE_Stored_Value", stored);
  }
  
  public void sendChangeToClients() {
    ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
    DataOutputStream outputStream = new DataOutputStream(bos);
    try {
      outputStream.writeInt(14);
      outputStream.writeInt(this.xCoord);
      outputStream.writeInt(this.yCoord);
      outputStream.writeInt(this.zCoord);
      outputStream.writeDouble(this.stored);
    } catch (Exception ex) {
      ex.printStackTrace();
    }<commit_msg>Experienced Consumer eats xp orbs<commit_after>package oe.block.tile;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import oe.api.OETileInterface;
import oe.api.OE_API;
import oe.api.lib.OEType;
import oe.helper.ConfigHelper;
import cpw.mods.fml.common.network.PacketDispatcher;

public class TileExperienceConsumer extends TileEntity implements OETileInterface {
  public double stored;
  public int factor;
  
  public TileExperienceConsumer() {
    super();
    ConfigHelper.load();
    factor = ConfigHelper.other("QMC", "XP to QMC Factor", 10);
    ConfigHelper.save();
  }
  
  @Override
  public void onInventoryChanged() {
    sendChangeToClients();
  }
  
  @SuppressWarnings("unchecked")
  @Override
  public void updateEntity() {
    double pStored = stored;
    stored = OE_API.provide(xCoord, yCoord, zCoord, worldObj, stored);
    if (pStored != stored) {
      onInventoryChanged();
    }
    Block block = Block.blocksList[worldObj.getBlockId(xCoord, yCoord, zCoord)];
    AxisAlignedBB boundingBox = block.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord, zCoord);
    int radius = 2;
    List<EntityXPOrb> list = (List<EntityXPOrb>) worldObj.getEntitiesWithinAABB((Class<?>) EntityXPOrb.class, boundingBox.expand(radius, radius, radius));
    for (EntityXPOrb xp : list) {
      if (xp.xpOrbAge >= 20) {
        increaseQMC(xp.getXpValue() * factor);
        worldObj.removeEntity(xp);
      }
    }
  }
  
  @Override
  public void readFromNBT(NBTTagCompound TagCompound) {
    super.readFromNBT(TagCompound);
    stored = TagCompound.getDouble("OE_Stored_Value");
  }
  
  @Override
  public void writeToNBT(NBTTagCompound TagCompound) {
    super.writeToNBT(TagCompound);
    TagCompound.setDouble("OE_Stored_Value", stored);
  }
  
  public void sendChangeToClients() {
    ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
    DataOutputStream outputStream = new DataOutputStream(bos);
    try {
      outputStream.writeInt(14);
      outputStream.writeInt(this.xCoord);
      outputStream.writeInt(this.yCoord);
      outputStream.writeInt(this.zCoord);
      outputStream.writeDouble(this.stored);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
{'fraction_non_alphanumeric': 0.10496486057583314, 'fraction_numerical': 0.004307413284969395, 'mean_word_length': 4.277511961722488, 'pattern_counts': {'":': 0, '<': 6, '<?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': '405323', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1416, 'n_words': 261}