nus-yam/ex-repair huggingface dataset:
Program: 169868
Project: 169868
Buggy source:
public void init(){
  GameRegistry.registerTileEntity(TileEntityCruiseLauncher.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileLauncherBase.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileEntityLauncherScreen.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileEntitySupportFrame.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileEntityRadarStation.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileEMPTower.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileMissileCoordinator.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileEntityExplosive.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileMissileAssembler.class,"String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  GameRegistry.registerTileEntity(TileCruiseLauncher.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileLauncherBase.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileLauncherScreen.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileEntitySupportFrame.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileRadarStation.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileEMPTower.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileMissileCoordinator.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileExplosive.class,"String_Node_Str");
  GameRegistry.registerTileEntity(TileMissileAssembler.class,"String_Node_Str");
}
Program: 169869
Project: 169869
Buggy source:
@Override public Object getServerGuiElement(int ID,EntityPlayer player,World world,int x,int y,int z){
  TileEntity tileEntity=world.getBlockTileEntity(x,y,z);
  if (tileEntity instanceof TileEntityCruiseLauncher) {
    return new ContainerCruiseLauncher(player.inventory,(TileEntityCruiseLauncher)tileEntity);
  }
 else   if (tileEntity instanceof TileLauncherBase) {
    return new ContainerLauncher(player.inventory,(TileLauncherBase)tileEntity);
  }
 else   if (tileEntity instanceof TileMissileCoordinator) {
    return new ContainerMissileCoordinator(player.inventory,(TileMissileCoordinator)tileEntity);
  }
 else   if (tileEntity instanceof TileMissileAssembler) {
    return new ContainerMissileTable(player.inventory,(TileMissileAssembler)tileEntity);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getServerGuiElement(int ID,EntityPlayer player,World world,int x,int y,int z){
  TileEntity tileEntity=world.getBlockTileEntity(x,y,z);
  if (tileEntity instanceof TileCruiseLauncher) {
    return new ContainerCruiseLauncher(player.inventory,(TileCruiseLauncher)tileEntity);
  }
 else   if (tileEntity instanceof TileLauncherBase) {
    return new ContainerLauncher(player.inventory,(TileLauncherBase)tileEntity);
  }
 else   if (tileEntity instanceof TileMissileCoordinator) {
    return new ContainerMissileCoordinator(player.inventory,(TileMissileCoordinator)tileEntity);
  }
 else   if (tileEntity instanceof TileMissileAssembler) {
    return new ContainerMissileTable(player.inventory,(TileMissileAssembler)tileEntity);
  }
  return null;
}
Program: 169870
Project: 169870
Buggy source:
public ContainerCruiseLauncher(InventoryPlayer par1InventoryPlayer,TileEntityCruiseLauncher tileEntity){
  this.tileEntity=tileEntity;
  this.addSlotToContainer(new SlotSpecific(tileEntity,0,151,23,ItemMissile.class));
  this.addSlotToContainer(new SlotEnergyItem(tileEntity,1,151,47));
  int var3;
  for (var3=0; var3 < 3; ++var3) {
    for (int var4=0; var4 < 9; ++var4) {
      this.addSlotToContainer(new Slot(par1InventoryPlayer,var4 + var3 * 9 + 9,8 + var4 * 18,84 + var3 * 18));
    }
  }
  for (var3=0; var3 < 9; ++var3) {
    this.addSlotToContainer(new Slot(par1InventoryPlayer,var3,8 + var3 * 18,142));
  }
}

Fixed version (ground truth):
public ContainerCruiseLauncher(InventoryPlayer par1InventoryPlayer,TileCruiseLauncher tileEntity){
  this.tileEntity=tileEntity;
  this.addSlotToContainer(new SlotSpecific(tileEntity,0,151,23,ItemMissile.class));
  this.addSlotToContainer(new SlotEnergyItem(tileEntity,1,151,47));
  int var3;
  for (var3=0; var3 < 3; ++var3) {
    for (int var4=0; var4 < 9; ++var4) {
      this.addSlotToContainer(new Slot(par1InventoryPlayer,var4 + var3 * 9 + 9,8 + var4 * 18,84 + var3 * 18));
    }
  }
  for (var3=0; var3 < 9; ++var3) {
    this.addSlotToContainer(new Slot(par1InventoryPlayer,var3,8 + var3 * 18,142));
  }
}
Program: 169872
Project: 169872
Buggy source:
/** 
 * Draw the foreground layer for the GuiContainer (everything in front of the items) 
 */
@Override protected void drawGuiContainerForegroundLayer(int par1,int par2){
  this.fontRenderer.drawString("String_Node_Str" + tileEntity.getInvName(),52,6,4210752);
  this.fontRenderer.drawString("String_Node_Str",8,23,4210752);
  this.fontRenderer.drawString("String_Node_Str",8,39,4210752);
  this.fontRenderer.drawString("String_Node_Str",8,54,4210752);
  this.fontRenderer.drawString("String_Node_Str",70,20,4210752);
  this.textFieldX.drawTextBox();
  this.textFieldZ.drawTextBox();
  this.textFieldY.drawTextBox();
  this.textFieldFreq.drawTextBox();
  this.fontRenderer.drawString(this.tileEntity.getStatus(),70,50,4210752);
  this.fontRenderer.drawString(this.tileEntity.getVoltageInput(null) + "String_Node_Str",70,60,4210752);
  this.fontRenderer.drawString(UnitDisplay.getDisplayShort(this.tileEntity.energy.getEnergy(),Unit.JOULES) + "String_Node_Str" + UnitDisplay.getDisplayShort(this.tileEntity.getMaxEnergyStored(),Unit.JOULES),70,70,4210752);
  this.fontRenderer.drawString(StatCollector.translateToLocal("String_Node_Str"),8,this.ySize - 96 + 2,4210752);
}

Fixed version (ground truth):
/** 
 * Draw the foreground layer for the GuiContainer (everything in front of the items) 
 */
@Override protected void drawGuiContainerForegroundLayer(int par1,int par2){
  this.fontRenderer.drawString("String_Node_Str" + tileEntity.getInvName(),52,6,4210752);
  this.fontRenderer.drawString("String_Node_Str",8,23,4210752);
  this.fontRenderer.drawString("String_Node_Str",8,39,4210752);
  this.fontRenderer.drawString("String_Node_Str",8,54,4210752);
  this.fontRenderer.drawString("String_Node_Str",70,20,4210752);
  this.textFieldX.drawTextBox();
  this.textFieldZ.drawTextBox();
  this.textFieldY.drawTextBox();
  this.textFieldFreq.drawTextBox();
  this.fontRenderer.drawString(this.tileEntity.getStatus(),70,50,4210752);
  this.fontRenderer.drawString(this.tileEntity.getVoltageInput(null) + "String_Node_Str",70,60,4210752);
  this.fontRenderer.drawString(UnitDisplay.getDisplayShort(this.tileEntity.energy.getEnergy(),Unit.JOULES) + "String_Node_Str" + UnitDisplay.getDisplayShort(this.tileEntity.energy.getEnergyCapacity(),Unit.JOULES),70,70,4210752);
  this.fontRenderer.drawString(StatCollector.translateToLocal("String_Node_Str"),8,this.ySize - 96 + 2,4210752);
}
Program: 169873
Project: 169873
Buggy source:
public GuiCruiseLauncher(InventoryPlayer par1InventoryPlayer,TileEntityCruiseLauncher tileEntity){
  super(new ContainerCruiseLauncher(par1InventoryPlayer,tileEntity));
  this.tileEntity=tileEntity;
}

Fixed version (ground truth):
public GuiCruiseLauncher(InventoryPlayer par1InventoryPlayer,TileCruiseLauncher tileEntity){
  super(new ContainerCruiseLauncher(par1InventoryPlayer,tileEntity));
  this.tileEntity=tileEntity;
}
Program: 169874
Project: 169874
Buggy source:
public GuiLauncherScreen(TileEntityLauncherScreen par2ICBMTileEntityMissileLauncher){
  this.tileEntity=par2ICBMTileEntityMissileLauncher;
}

Fixed version (ground truth):
public GuiLauncherScreen(TileLauncherScreen par2ICBMTileEntityMissileLauncher){
  this.tileEntity=par2ICBMTileEntityMissileLauncher;
}
Program: 169876
Project: 169876
Buggy source:
@Override public void updateScreen(){
  super.updateScreen();
  if (Mouse.isInsideWindow()) {
    if (Mouse.getEventButton() == -1) {
      this.mousePosition=new Vector2(Mouse.getEventX() * this.width / this.mc.displayWidth,this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1);
      float difference=TileEntityRadarStation.MAX_DETECTION_RANGE / this.radarMapRadius;
      if (this.mousePosition.x > this.radarCenter.x - difference && this.mousePosition.x < this.radarCenter.x + difference && this.mousePosition.y > this.radarCenter.y - difference && this.mousePosition.y < this.radarCenter.y + difference) {
        int xDifference=(int)(this.mousePosition.x - this.radarCenter.x);
        int yDifference=(int)(this.mousePosition.y - this.radarCenter.y);
        int xBlockDistance=(int)(xDifference * this.radarMapRadius);
        int yBlockDistance=(int)(yDifference * this.radarMapRadius);
        this.mouseOverCoords=new Vector2(this.tileEntity.xCoord + xBlockDistance,this.tileEntity.zCoord - yBlockDistance);
      }
    }
  }
  if (!this.textFieldSafetyZone.isFocused())   this.textFieldSafetyZone.setText(this.tileEntity.safetyRange + "String_Node_Str");
  if (!this.textFieldAlarmRange.isFocused())   this.textFieldAlarmRange.setText(this.tileEntity.alarmRange + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void updateScreen(){
  super.updateScreen();
  if (Mouse.isInsideWindow()) {
    if (Mouse.getEventButton() == -1) {
      this.mousePosition=new Vector2(Mouse.getEventX() * this.width / this.mc.displayWidth,this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1);
      float difference=TileRadarStation.MAX_DETECTION_RANGE / this.radarMapRadius;
      if (this.mousePosition.x > this.radarCenter.x - difference && this.mousePosition.x < this.radarCenter.x + difference && this.mousePosition.y > this.radarCenter.y - difference && this.mousePosition.y < this.radarCenter.y + difference) {
        int xDifference=(int)(this.mousePosition.x - this.radarCenter.x);
        int yDifference=(int)(this.mousePosition.y - this.radarCenter.y);
        int xBlockDistance=(int)(xDifference * this.radarMapRadius);
        int yBlockDistance=(int)(yDifference * this.radarMapRadius);
        this.mouseOverCoords=new Vector2(this.tileEntity.xCoord + xBlockDistance,this.tileEntity.zCoord - yBlockDistance);
      }
    }
  }
  if (!this.textFieldSafetyZone.isFocused())   this.textFieldSafetyZone.setText(this.tileEntity.safetyRange + "String_Node_Str");
  if (!this.textFieldAlarmRange.isFocused())   this.textFieldAlarmRange.setText(this.tileEntity.alarmRange + "String_Node_Str");
}
Program: 169877
Project: 169877
Buggy source:
public GuiRadarStation(TileEntityRadarStation tileEntity){
  this.tileEntity=tileEntity;
  mouseOverCoords=new Vector2(this.tileEntity.xCoord,this.tileEntity.zCoord);
  this.xSize=256;
  radarCenter=new Vector2(this.containerPosX + this.xSize / 3 - 14,this.containerPosY + this.ySize / 2 + 4);
  radarMapRadius=TileEntityRadarStation.MAX_DETECTION_RANGE / 63.8F;
}

Fixed version (ground truth):
public GuiRadarStation(TileRadarStation tileEntity){
  this.tileEntity=tileEntity;
  mouseOverCoords=new Vector2(this.tileEntity.xCoord,this.tileEntity.zCoord);
  this.xSize=256;
  radarCenter=new Vector2(this.containerPosX + this.xSize / 3 - 14,this.containerPosY + this.ySize / 2 + 4);
  radarMapRadius=TileRadarStation.MAX_DETECTION_RANGE / 63.8F;
}
Program: 169879
Project: 169879
Buggy source:
/** 
 * Call this method from you GuiScreen to process the keys into textbox. 
 */
@Override public void keyTyped(char par1,int par2){
  super.keyTyped(par1,par2);
  this.textFieldSafetyZone.textboxKeyTyped(par1,par2);
  this.textFieldAlarmRange.textboxKeyTyped(par1,par2);
  this.textFieldFrequency.textboxKeyTyped(par1,par2);
  try {
    int newSafetyRadius=Math.min(TileEntityRadarStation.MAX_DETECTION_RANGE,Math.max(0,Integer.parseInt(this.textFieldSafetyZone.getText())));
    this.tileEntity.safetyRange=newSafetyRadius;
    PacketDispatcher.sendPacketToServer(ICBMCore.PACKET_TILE.getPacket(this.tileEntity,2,this.tileEntity.safetyRange));
  }
 catch (  NumberFormatException e) {
  }
  try {
    int newAlarmRadius=Math.min(TileEntityRadarStation.MAX_DETECTION_RANGE,Math.max(0,Integer.parseInt(this.textFieldAlarmRange.getText())));
    this.tileEntity.alarmRange=newAlarmRadius;
    PacketDispatcher.sendPacketToServer(ICBMCore.PACKET_TILE.getPacket(this.tileEntity,3,this.tileEntity.alarmRange));
  }
 catch (  NumberFormatException e) {
  }
  try {
    this.tileEntity.setFrequency(Integer.parseInt(this.textFieldFrequency.getText()));
    PacketDispatcher.sendPacketToServer(ICBMCore.PACKET_TILE.getPacket(this.tileEntity,4,this.tileEntity.getFrequency()));
  }
 catch (  NumberFormatException e) {
  }
}

Fixed version (ground truth):
/** 
 * Call this method from you GuiScreen to process the keys into textbox. 
 */
@Override public void keyTyped(char par1,int par2){
  super.keyTyped(par1,par2);
  this.textFieldSafetyZone.textboxKeyTyped(par1,par2);
  this.textFieldAlarmRange.textboxKeyTyped(par1,par2);
  this.textFieldFrequency.textboxKeyTyped(par1,par2);
  try {
    int newSafetyRadius=Math.min(TileRadarStation.MAX_DETECTION_RANGE,Math.max(0,Integer.parseInt(this.textFieldSafetyZone.getText())));
    this.tileEntity.safetyRange=newSafetyRadius;
    PacketDispatcher.sendPacketToServer(ICBMCore.PACKET_TILE.getPacket(this.tileEntity,2,this.tileEntity.safetyRange));
  }
 catch (  NumberFormatException e) {
  }
  try {
    int newAlarmRadius=Math.min(TileRadarStation.MAX_DETECTION_RANGE,Math.max(0,Integer.parseInt(this.textFieldAlarmRange.getText())));
    this.tileEntity.alarmRange=newAlarmRadius;
    PacketDispatcher.sendPacketToServer(ICBMCore.PACKET_TILE.getPacket(this.tileEntity,3,this.tileEntity.alarmRange));
  }
 catch (  NumberFormatException e) {
  }
  try {
    this.tileEntity.setFrequency(Integer.parseInt(this.textFieldFrequency.getText()));
    PacketDispatcher.sendPacketToServer(ICBMCore.PACKET_TILE.getPacket(this.tileEntity,4,this.tileEntity.getFrequency()));
  }
 catch (  NumberFormatException e) {
  }
}
Program: 169880
Project: 169880
Buggy source:
/** 
 * Draw the foreground layer for the GuiContainer (everything in front of the items) 
 */
@Override protected void drawForegroundLayer(int var2,int var3,float var1){
  this.fontRenderer.drawString("String_Node_Str" + LanguageUtility.getLocal("String_Node_Str"),this.xSize / 2 - 30,6,4210752);
  this.fontRenderer.drawString("String_Node_Str",155,18,4210752);
  this.fontRenderer.drawString("String_Node_Str" + (int)Math.round(mouseOverCoords.x) + "String_Node_Str"+ (int)Math.round(mouseOverCoords.y),155,30,4210752);
  this.fontRenderer.drawString("String_Node_Str" + this.info,155,42,4210752);
  this.fontRenderer.drawString("String_Node_Str" + this.info2,155,54,4210752);
  this.fontRenderer.drawString("String_Node_Str",152,70,4210752);
  this.textFieldSafetyZone.drawTextBox();
  this.fontRenderer.drawString("String_Node_Str",150,85,4210752);
  this.textFieldAlarmRange.drawTextBox();
  this.fontRenderer.drawString("String_Node_Str",155,100,4210752);
  this.textFieldFrequency.drawTextBox();
  this.fontRenderer.drawString(UnitDisplay.getDisplay(TileEntityRadarStation.WATTS,Unit.WATT),155,128,4210752);
  this.fontRenderer.drawString(UnitDisplay.getDisplay(this.tileEntity.getVoltageInput(null),Unit.VOLTAGE),155,138,4210752);
  String color="String_Node_Str";
  String status="String_Node_Str";
  if (this.tileEntity.energy.checkExtract()) {
    color="String_Node_Str";
    status="String_Node_Str";
  }
 else {
    status="String_Node_Str";
  }
  this.fontRenderer.drawString(color + status,155,150,4210752);
}

Fixed version (ground truth):
/** 
 * Draw the foreground layer for the GuiContainer (everything in front of the items) 
 */
@Override protected void drawForegroundLayer(int var2,int var3,float var1){
  this.fontRenderer.drawString("String_Node_Str" + LanguageUtility.getLocal("String_Node_Str"),this.xSize / 2 - 30,6,4210752);
  this.fontRenderer.drawString("String_Node_Str",155,18,4210752);
  this.fontRenderer.drawString("String_Node_Str" + (int)Math.round(mouseOverCoords.x) + "String_Node_Str"+ (int)Math.round(mouseOverCoords.y),155,30,4210752);
  this.fontRenderer.drawString("String_Node_Str" + this.info,155,42,4210752);
  this.fontRenderer.drawString("String_Node_Str" + this.info2,155,54,4210752);
  this.fontRenderer.drawString("String_Node_Str",152,70,4210752);
  this.textFieldSafetyZone.drawTextBox();
  this.fontRenderer.drawString("String_Node_Str",150,85,4210752);
  this.textFieldAlarmRange.drawTextBox();
  this.fontRenderer.drawString("String_Node_Str",155,100,4210752);
  this.textFieldFrequency.drawTextBox();
  this.fontRenderer.drawString(UnitDisplay.getDisplay(TileRadarStation.WATTS,Unit.WATT),155,128,4210752);
  this.fontRenderer.drawString(UnitDisplay.getDisplay(this.tileEntity.getVoltageInput(null),Unit.VOLTAGE),155,138,4210752);
  String color="String_Node_Str";
  String status="String_Node_Str";
  if (this.tileEntity.energy.checkExtract()) {
    color="String_Node_Str";
    status="String_Node_Str";
  }
 else {
    status="String_Node_Str";
  }
  this.fontRenderer.drawString(color + status,155,150,4210752);
}
Program: 169882
Project: 169882
Buggy source:
@Override public Packet getDescriptionPacket(){
  return PacketHandler.instance().getTilePacket(ICBMContraption.CHANNEL,"String_Node_Str",this,this.energy.getEnergy(),this.frequency,this.mode,this.isInverted,this.minCoord.intX(),this.minCoord.intY(),this.minCoord.intZ(),this.maxCoord.intX(),this.maxCoord.intY(),this.maxCoord.intZ());
}

Fixed version (ground truth):
@Override public Packet getDescriptionPacket(){
  return ICBMCore.PACKET_TILE.getPacket(this,1,this.energy.getEnergy(),this.frequency,this.mode,this.isInverted,this.minCoord.intX(),this.minCoord.intY(),this.minCoord.intZ(),this.maxCoord.intX(),this.maxCoord.intY(),this.maxCoord.intZ());
}
Program: 169883
Project: 169883
Buggy source:
public TileDetector(){
  this.energy=new EnergyStorageHandler(100);
}

Fixed version (ground truth):
public TileDetector(){
  this.energy=new EnergyStorageHandler(200,100);
}
Program: 169884
Project: 169884
Buggy source:
@Override public void onReceivePacket(ByteArrayDataInput data,EntityPlayer player,Object... extra){
  try {
    if (!super.simplePacket(id,data,player)) {
      if (id.equalsIgnoreCase("String_Node_Str")) {
        this.setEnergy(ForgeDirection.UNKNOWN,data.readLong());
        this.frequency=data.readShort();
        this.mode=data.readByte();
        this.isInverted=data.readBoolean();
        this.minCoord=new Vector3(Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())));
        this.maxCoord=new Vector3(Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())));
      }
 else       if (id.equalsIgnoreCase("String_Node_Str")) {
        this.mode=data.readByte();
      }
 else       if (id.equalsIgnoreCase("String_Node_Str")) {
        this.frequency=data.readShort();
      }
 else       if (id.equalsIgnoreCase("String_Node_Str")) {
        this.minCoord=new Vector3(Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())));
      }
 else       if (id.equalsIgnoreCase("String_Node_Str")) {
        this.maxCoord=new Vector3(Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())));
      }
    }
 else {
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void onReceivePacket(ByteArrayDataInput data,EntityPlayer player,Object... extra){
  try {
switch (data.readInt()) {
case -1:
{
        if (data.readBoolean()) {
          this.playersUsing.add(player);
        }
 else {
          this.playersUsing.remove(player);
        }
      }
case 0:
{
      this.setEnergy(ForgeDirection.UNKNOWN,data.readLong());
      this.frequency=data.readShort();
      this.mode=data.readByte();
      this.isInverted=data.readBoolean();
      this.minCoord=new Vector3(Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())));
      this.maxCoord=new Vector3(Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())));
      break;
    }
case 1:
{
    this.mode=data.readByte();
    break;
  }
case 2:
{
  this.frequency=data.readShort();
  break;
}
case 3:
{
this.minCoord=new Vector3(Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())));
break;
}
case 4:
{
this.maxCoord=new Vector3(Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())),Math.max(0,Math.min(MAX_DISTANCE,data.readInt())));
break;
}
}
}
 catch (Exception e) {
e.printStackTrace();
}
}
Program: 169885
Project: 169885
Buggy source:
@Override protected boolean onDamageEntity(Entity entity){
  if (entity instanceof EntityExplosion) {
    if (((EntityExplosion)entity).baoZha instanceof BlastRedMatter) {
      entity.setDead();
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean onDamageEntity(Entity entity){
  if (entity instanceof EntityExplosion) {
    if (((EntityExplosion)entity).baoZha instanceof BlastRedmatter) {
      entity.setDead();
      return true;
    }
  }
  return false;
}
Program: 169887
Project: 169887
Buggy source:
@Override public void doCreateExplosion(World world,double x,double y,double z,Entity entity){
  new BlastRedMatter(world,entity,x,y,z,35).explode();
}

Fixed version (ground truth):
@Override public void doCreateExplosion(World world,double x,double y,double z,Entity entity){
  new BlastRedmatter(world,entity,x,y,z,35).explode();
}
Program: 169889
Project: 169889
Buggy source:
@Init public void load(FMLInitializationEvent evt){
  super.init(evt);
  ICBMCore.setModMetadata(NAME,metadata);
}

Fixed version (ground truth):
@EventHandler public void load(FMLInitializationEvent evt){
  super.init(evt);
  ICBMCore.setModMetadata(NAME,metadata);
}
Program: 169892
Project: 169892
Buggy source:
@EventHandler public void init(FMLInitializationEvent event){
  if (!isInit) {
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    UniversalRecipe.init();
    isInit=true;
  }
}

Fixed version (ground truth):
@EventHandler public void init(FMLInitializationEvent event){
  if (!isInit) {
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    BasicRegistry.register("String_Node_Str");
    isInit=true;
  }
}
Program: 169893
Project: 169893
Buggy source:
@EventHandler public void postInit(FMLPostInitializationEvent event){
  if (!isPostInit) {
    GameRegistry.addSmelting(blockSulfurOre.blockID,new ItemStack(itemSulfurDust,4),0.8f);
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.gunpowder,3),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'@',"String_Node_Str",'?',Item.coal}));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.gunpowder,3),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'@',"String_Node_Str",'?',new ItemStack(Item.coal,1,1)}));
    GameRegistry.addRecipe(new ShapedOreRecipe(Block.tnt,new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'@',Item.gunpowder,'R',Item.redstone}));
    GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(itemPoisonPowder,3),new Object[]{Item.spiderEye,Item.rottenFlesh}));
    isPostInit=true;
  }
}

Fixed version (ground truth):
@EventHandler public void postInit(FMLPostInitializationEvent event){
  if (!isPostInit) {
    UniversalRecipe.init();
    GameRegistry.addSmelting(blockSulfurOre.blockID,new ItemStack(itemSulfurDust,4),0.8f);
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.gunpowder,3),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'@',"String_Node_Str",'?',Item.coal}));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.gunpowder,3),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'@',"String_Node_Str",'?',new ItemStack(Item.coal,1,1)}));
    GameRegistry.addRecipe(new ShapedOreRecipe(Block.tnt,new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'@',Item.gunpowder,'R',Item.redstone}));
    GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(itemPoisonPowder,3),new Object[]{Item.spiderEye,Item.rottenFlesh}));
    isPostInit=true;
  }
}
Program: 169894
Project: 169894
Buggy source:
@Override public boolean onActivated(EntityPlayer entityPlayer){
  if (entityPlayer.inventory.getCurrentItem() != null && this.getStackInSlot(0) == null) {
    if (entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemMissile) {
      this.setInventorySlotContents(0,entityPlayer.inventory.getCurrentItem());
      entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem,null);
      return true;
    }
  }
  entityPlayer.openGui(ICBMExplosion.instance,0,this.worldObj,this.xCoord,this.yCoord,this.zCoord);
  return true;
}

Fixed version (ground truth):
@Override public boolean onActivated(EntityPlayer entityPlayer){
  if (entityPlayer.inventory.getCurrentItem() != null && this.getStackInSlot(0) == null) {
    if (entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemMissile) {
      this.setInventorySlotContents(0,entityPlayer.inventory.getCurrentItem());
      entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem,null);
      this.onInventoryChanged();
      return true;
    }
  }
  entityPlayer.openGui(ICBMExplosion.instance,0,this.worldObj,this.xCoord,this.yCoord,this.zCoord);
  return true;
}
Program: 169895
Project: 169895
Buggy source:
public void onInventoryChanged(){
  super.onInventoryChanged();
  if (!this.worldObj.isRemote) {
    if (this.getStackInSlot(0) != null && this.getStackInSlot(0).getItem() instanceof ItemMissile) {
      missileID=this.getStackInSlot(0).getItemDamage();
    }
  }
}

Fixed version (ground truth):
public void onInventoryChanged(){
  super.onInventoryChanged();
  if (!this.worldObj.isRemote) {
    if (this.getStackInSlot(0) != null && this.getStackInSlot(0).getItem() instanceof ItemMissile) {
      missileID=this.getStackInSlot(0).getItemDamage();
    }
  }
  this.worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}
Program: 169896
Project: 169896
Buggy source:
@Override public Packet getDescriptionPacket(){
  return PacketManager.getPacket(ICBMExplosion.CHANNEL,((byte)0),((byte)this.rotationSide),((byte)this.placedSide.ordinal()));
}

Fixed version (ground truth):
@Override public Packet getDescriptionPacket(){
  return PacketManager.getPacket(ICBMExplosion.CHANNEL,this,((byte)0),((byte)this.rotationSide),((byte)this.placedSide.ordinal()));
}
Program: 169897
Project: 169897
Buggy source:
public void renderAModelAt(TileEntityMissileTable tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  this.bindTexture(TEXTURE_FILE);
  GL11.glTranslatef((float)x + 0.5F,(float)y + 1.5F,(float)z + 0.5F);
  GL11.glRotatef(180F,0.0F,0.0F,1.0F);
  if (tileEntity.placedSide == ForgeDirection.UP || tileEntity.placedSide == ForgeDirection.DOWN) {
    if (tileEntity.rotationSide == 1) {
      GL11.glRotatef(90F,0.0F,1.0F,0.0F);
    }
 else     if (tileEntity.rotationSide == 2) {
      GL11.glRotatef(180F,0.0F,1.0F,0.0F);
    }
 else     if (tileEntity.rotationSide == 3) {
      GL11.glRotatef(-90F,0.0F,1.0F,0.0F);
    }
  }
 else {
    if (tileEntity.rotationSide == 0 || tileEntity.rotationSide == 2) {
      if (tileEntity.placedSide == ForgeDirection.NORTH || tileEntity.placedSide == ForgeDirection.EAST) {
      }
 else       if (tileEntity.placedSide == ForgeDirection.SOUTH || tileEntity.placedSide == ForgeDirection.WEST) {
      }
    }
 else {
    }
  }
  MODEL.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  GL11.glPopMatrix();
}

Fixed version (ground truth):
public void renderAModelAt(TileEntityMissileTable tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  this.bindTexture(TEXTURE_FILE);
  GL11.glTranslatef((float)x + 0.5F,(float)y + 1.5F,(float)z + 0.5F);
  GL11.glRotatef(180F,0.0F,0.0F,1.0F);
  if (tileEntity.placedSide == ForgeDirection.UP || tileEntity.placedSide == ForgeDirection.DOWN) {
    if (tileEntity.rotationSide == 1) {
      GL11.glRotatef(90F,0.0F,1.0F,0.0F);
    }
 else     if (tileEntity.rotationSide == 2) {
      GL11.glRotatef(180F,0.0F,1.0F,0.0F);
    }
 else     if (tileEntity.rotationSide == 3) {
      GL11.glRotatef(-90F,0.0F,1.0F,0.0F);
    }
    if (tileEntity.placedSide == ForgeDirection.DOWN) {
      GL11.glRotatef(180F,0.0F,0.0F,1.0F);
    }
  }
 else {
    if (tileEntity.rotationSide == 0 || tileEntity.rotationSide == 2) {
      if (tileEntity.placedSide == ForgeDirection.NORTH || tileEntity.placedSide == ForgeDirection.EAST) {
      }
 else       if (tileEntity.placedSide == ForgeDirection.SOUTH || tileEntity.placedSide == ForgeDirection.WEST) {
      }
    }
 else {
    }
  }
  MODEL.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  GL11.glPopMatrix();
}
Program: 169898
Project: 169898
Buggy source:
/** 
 * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
 * @param rot
 * @param placeSide 
 */
public static boolean canPlaceBlockAt(World world,int x,int y,int z,ForgeDirection placeSide,int rot){
  Block block=Block.blocksList[world.getBlockId(x,y,z)];
  if (block == null || block.isBlockReplaceable(world,x,y,z)) {
    Vector3[] vecs=TileEntityMissileTable.getMultiBlockVectors(placeSide,(byte)rot);
    for (int i=0; i > vecs.length; i++) {
      block=Block.blocksList[world.getBlockId(x + vecs[i].intX(),y + vecs[i].intY(),z + vecs[i].intZ())];
      if (block != null && !block.isBlockReplaceable(world,x,y,z)) {
        return false;
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
 * @param rot
 * @param placeSide 
 */
public static boolean canPlaceBlockAt(World world,int x,int y,int z,ForgeDirection placeSide,int rot){
  Vector3 pos=new Vector3(x,y,z);
  Block block=Block.blocksList[pos.getBlockID(world)];
  if (block == null || block.isBlockReplaceable(world,x,y,z)) {
    Vector3[] vecs=TileEntityMissileTable.getMultiBlockVectors(placeSide,(byte)rot);
    for (    Vector3 vec : vecs) {
      block=Block.blocksList[pos.clone().translate(vec).getBlockID(world)];
      if (block != null && !block.isBlockReplaceable(world,x,y,z)) {
        return false;
      }
    }
    return true;
  }
  return false;
}
Program: 169899
Project: 169899
Buggy source:
public void setRotation(byte rot){
  if (BlockMissileTable.canPlaceBlockAt(this.worldObj,this.xCoord,this.yCoord,this.zCoord,this.placedSide,rot)) {
    this.rotationSide=rot;
  }
}

Fixed version (ground truth):
public void setRotation(byte rot){
  if (BlockMissileTable.canRotateBlockTo(this.worldObj,this.xCoord,this.yCoord,this.zCoord,this.placedSide,rot)) {
    this.rotationSide=rot;
  }
}
Program: 169900
Project: 169900
Buggy source:
@Override public void setDirection(ForgeDirection direction){
  byte rot=0;
  if (direction == ForgeDirection.NORTH) {
    rot=0;
  }
 else   if (direction == ForgeDirection.SOUTH) {
    rot=2;
  }
 else   if (direction == ForgeDirection.EAST) {
    rot=1;
  }
 else {
    rot=3;
  }
  if (BlockMissileTable.canPlaceBlockAt(this.worldObj,this.xCoord,this.yCoord,this.zCoord,this.placedSide,rot)) {
    this.rotationSide=rot;
    this.worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
  }
}

Fixed version (ground truth):
@Override public void setDirection(ForgeDirection direction){
  byte rot=0;
  if (direction == ForgeDirection.NORTH) {
    rot=0;
  }
 else   if (direction == ForgeDirection.SOUTH) {
    rot=2;
  }
 else   if (direction == ForgeDirection.EAST) {
    rot=1;
  }
 else {
    rot=3;
  }
  if (BlockMissileTable.canRotateBlockTo(this.worldObj,this.xCoord,this.yCoord,this.zCoord,this.placedSide,rot)) {
    this.rotationSide=rot;
    this.worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
  }
}
Program: 169901
Project: 169901
Buggy source:
public void renderAModelAt(TileEntityMissileTable tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  this.bindTexture(TEXTURE_FILE);
  GL11.glTranslatef((float)x + 0.5F,(float)y + 1.5F,(float)z + 0.5F);
  GL11.glRotatef(180F,0.0F,0.0F,1.0F);
  if (tileEntity.placedSide == ForgeDirection.UP || tileEntity.placedSide == ForgeDirection.DOWN) {
    if (tileEntity.rotationSide == 1 || tileEntity.rotationSide == 3) {
      GL11.glRotatef(90F,0.0F,1.0F,0.0F);
    }
  }
 else {
    if (tileEntity.rotationSide == 0 || tileEntity.rotationSide == 2) {
      if (tileEntity.placedSide == ForgeDirection.NORTH || tileEntity.placedSide == ForgeDirection.EAST) {
      }
 else       if (tileEntity.placedSide == ForgeDirection.SOUTH || tileEntity.placedSide == ForgeDirection.WEST) {
      }
    }
 else {
    }
  }
  MODEL.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  GL11.glPopMatrix();
}

Fixed version (ground truth):
public void renderAModelAt(TileEntityMissileTable tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  this.bindTexture(TEXTURE_FILE);
  GL11.glTranslatef((float)x + 0.5F,(float)y + 1.5F,(float)z + 0.5F);
  GL11.glRotatef(180F,0.0F,0.0F,1.0F);
  if (tileEntity.placedSide == ForgeDirection.UP || tileEntity.placedSide == ForgeDirection.DOWN) {
    if (tileEntity.rotationSide == 1) {
      GL11.glRotatef(90F,0.0F,1.0F,0.0F);
    }
 else     if (tileEntity.rotationSide == 2) {
      GL11.glRotatef(180F,0.0F,1.0F,0.0F);
    }
 else     if (tileEntity.rotationSide == 3) {
      GL11.glRotatef(-90F,0.0F,1.0F,0.0F);
    }
  }
 else {
    if (tileEntity.rotationSide == 0 || tileEntity.rotationSide == 2) {
      if (tileEntity.placedSide == ForgeDirection.NORTH || tileEntity.placedSide == ForgeDirection.EAST) {
      }
 else       if (tileEntity.placedSide == ForgeDirection.SOUTH || tileEntity.placedSide == ForgeDirection.WEST) {
      }
    }
 else {
    }
  }
  MODEL.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  MODEL_CLAW.render(0.0625F);
  GL11.glPopMatrix();
}
Program: 169902
Project: 169902
Buggy source:
public static void cleanUpArray(){
  try {
    Iterator<TileEntity> it=detectableTileEntities.iterator();
    while (it.hasNext()) {
      TileEntity tileEntity=it.next();
      if (tileEntity == null) {
        it.remove();
      }
 else       if (tileEntity.isInvalid()) {
        it.remove();
      }
 else       if (tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord,tileEntity.yCoord,tileEntity.zCoord) != tileEntity) {
        it.remove();
      }
    }
    Iterator<Entity> it2=detectableEntities.iterator();
    while (it2.hasNext()) {
      Entity entity=it2.next();
      if (entity == null) {
        it2.remove();
      }
 else       if (entity.isDead) {
        it2.remove();
      }
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void cleanUpArray(){
  try {
synchronized (detectableEntities) {
      Iterator<TileEntity> it=detectableTileEntities.iterator();
      while (it.hasNext()) {
        TileEntity tileEntity=it.next();
        if (tileEntity == null) {
          it.remove();
        }
 else         if (tileEntity.isInvalid()) {
          it.remove();
        }
 else         if (tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord,tileEntity.yCoord,tileEntity.zCoord) != tileEntity) {
          it.remove();
        }
      }
      Iterator<Entity> it2=detectableEntities.iterator();
      while (it2.hasNext()) {
        Entity entity=it2.next();
        if (entity == null) {
          it2.remove();
        }
 else         if (entity.isDead) {
          it2.remove();
        }
      }
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}
Program: 169903
Project: 169903
Buggy source:
public static List<Entity> getEntitiesWithinRadius(Vector2 vector,int radius){
  cleanUpArray();
  List<Entity> returnArray=new ArrayList<Entity>();
  for (  Entity entity : detectableEntities) {
    if (Vector2.distance(vector,new Vector3(entity).toVector2()) <= radius) {
      returnArray.add(entity);
    }
  }
  return returnArray;
}

Fixed version (ground truth):
public static List<Entity> getEntitiesWithinRadius(Vector2 vector,int radius){
  cleanUpArray();
  List<Entity> returnArray=new ArrayList<Entity>();
synchronized (detectableEntities) {
    for (    Entity entity : detectableEntities) {
      if (Vector2.distance(vector,new Vector3(entity).toVector2()) <= radius) {
        returnArray.add(entity);
      }
    }
  }
  return returnArray;
}
Program: 169904
Project: 169904
Buggy source:
public static void unregister(Entity entity){
  if (detectableEntities.contains(entity)) {
    detectableEntities.remove(entity);
  }
}

Fixed version (ground truth):
public static void unregister(Entity entity){
synchronized (detectableEntities) {
    if (detectableEntities.contains(entity)) {
      detectableEntities.remove(entity);
    }
  }
}
Program: 169905
Project: 169905
Buggy source:
public static List<TileEntity> getTileEntitiesInArea(Vector2 minVector,Vector2 maxVector){
  cleanUpArray();
  List<TileEntity> returnArray=new ArrayList<TileEntity>();
  for (  TileEntity tileEntity : detectableTileEntities) {
    if (new Region2(minVector,maxVector).isIn(new Vector3(tileEntity).toVector2())) {
      returnArray.add(tileEntity);
    }
  }
  return returnArray;
}

Fixed version (ground truth):
public static List<TileEntity> getTileEntitiesInArea(Vector2 minVector,Vector2 maxVector){
  cleanUpArray();
  List<TileEntity> returnArray=new ArrayList<TileEntity>();
synchronized (detectableTileEntities) {
    for (    TileEntity tileEntity : detectableTileEntities) {
      if (new Region2(minVector,maxVector).isIn(new Vector3(tileEntity).toVector2())) {
        returnArray.add(tileEntity);
      }
    }
  }
  return returnArray;
}
Program: 169906
Project: 169906
Buggy source:
public static void register(Entity entity){
  if (!detectableEntities.contains(entity)) {
    detectableEntities.add(entity);
  }
}

Fixed version (ground truth):
public static void register(Entity entity){
synchronized (detectableEntities) {
    if (!detectableEntities.contains(entity)) {
      detectableEntities.add(entity);
    }
  }
}
Program: 169907
Project: 169907
Buggy source:
@Override public float getRequest(ForgeDirection direction){
  if (this.getTurret() != null) {
    if (this.getEnergyStored() < this.getTurret().getFiringRequest()) {
      return Math.max(this.getTurret().getFiringRequest(),0);
    }
  }
  return 0;
}

Fixed version (ground truth):
@Override public float getRequest(ForgeDirection direction){
  if (this.getTurret() != null) {
    if (this.getEnergyStored() < this.getTurret().getFiringRequest()) {
      return (float)Math.ceil(Math.max(this.getTurret().getFiringRequest(),0));
    }
  }
  return 0;
}
Program: 169908
Project: 169908
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (this.prevWatts != this.getEnergyStored()) {
    this.worldObj.markBlockForUpdate(this.xCoord,this.yCoord,this.zCoord);
  }
  if (!this.worldObj.isRemote) {
    for (int i=0; i < UPGRADE_START_INDEX; i++) {
      if (this.getEnergyStored() >= this.getRequest(null)) {
        break;
      }
      this.receiveElectricity(ElectricItemHelper.dischargeItem(this.getStackInSlot(i),this.getRequest(null)),true);
    }
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (this.prevWatts != this.getEnergyStored()) {
    this.worldObj.markBlockForUpdate(this.xCoord,this.yCoord,this.zCoord);
  }
  if (!this.worldObj.isRemote) {
    for (int i=0; i < UPGRADE_START_INDEX; i++) {
      if (this.getEnergyStored() > this.getRequest(null)) {
        break;
      }
      this.receiveElectricity(ElectricItemHelper.dischargeItem(this.getStackInSlot(i),this.getRequest(null)),true);
    }
  }
}
Program: 169909
Project: 169909
Buggy source:
@Override protected void writeEntityToNBT(NBTTagCompound nbt){
  nbt.setBoolean("String_Node_Str",this.shouldSit);
}

Fixed version (ground truth):
@Override protected void writeEntityToNBT(NBTTagCompound nbt){
  nbt.setBoolean("String_Node_Str",this.shouldSit);
  nbt.setCompoundTag("String_Node_Str",new Vector3(this.controller).writeToNBT(new NBTTagCompound()));
}
Program: 169910
Project: 169910
Buggy source:
@Override protected void readEntityFromNBT(NBTTagCompound nbt){
  this.shouldSit=nbt.getBoolean("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void readEntityFromNBT(NBTTagCompound nbt){
  this.shouldSit=nbt.getBoolean("String_Node_Str");
  Vector3 readVec=Vector3.readFromNBT(nbt.getCompoundTag("String_Node_Str"));
  if (readVec.getTileEntity(this.worldObj) != null) {
    this.controller=readVec.getTileEntity(this.worldObj);
  }
}
Program: 169911
Project: 169911
Buggy source:
@Override public boolean canActivateWeapon(){
  if (this.getPlatform() != null) {
    if (this.getPlatform().hasAmmunition(ProjectileType.RAILGUN) != null) {
      if (this.getPlatform().provideElectricity(ForgeDirection.UP,ElectricityPack.getFromWatts(this.getFiringRequest(),this.getVoltage()),false).getWatts() >= this.getFiringRequest()) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canActivateWeapon(){
  if (this.getPlatform() != null) {
    if (this.getPlatform().hasAmmunition(ProjectileType.RAILGUN) != null) {
      if (Math.round(this.getPlatform().provideElectricity(this.getFiringRequest(),false).getWatts()) >= this.getFiringRequest()) {
        return true;
      }
    }
  }
  return false;
}
Program: 169912
Project: 169912
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (this.entityFake != null) {
    if (this.entityFake.riddenByEntity instanceof EntityPlayer) {
      EntityPlayer mountedPlayer=(EntityPlayer)this.entityFake.riddenByEntity;
      if (mountedPlayer.rotationPitch > this.maxPitch) {
        mountedPlayer.rotationPitch=this.maxPitch;
      }
      if (mountedPlayer.rotationPitch < this.minPitch) {
        mountedPlayer.rotationPitch=this.minPitch;
      }
      this.currentRotationPitch=this.wantedRotationPitch=mountedPlayer.rotationPitch;
      this.currentRotationYaw=this.wantedRotationYaw=mountedPlayer.rotationYaw;
    }
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (this.entityFake == null || this.entityFake.isDead) {
    this.entityFake=new EJia(this.worldObj,new Vector3(this.xCoord + 0.5,this.yCoord + 1.2,this.zCoord + 0.5),this,true);
    this.worldObj.spawnEntityInWorld(this.entityFake);
  }
  if (this.entityFake.riddenByEntity instanceof EntityPlayer) {
    EntityPlayer mountedPlayer=(EntityPlayer)this.entityFake.riddenByEntity;
    if (mountedPlayer.rotationPitch > this.maxPitch) {
      mountedPlayer.rotationPitch=this.maxPitch;
    }
    if (mountedPlayer.rotationPitch < this.minPitch) {
      mountedPlayer.rotationPitch=this.minPitch;
    }
    this.currentRotationPitch=this.wantedRotationPitch=mountedPlayer.rotationPitch;
    this.currentRotationYaw=this.wantedRotationYaw=mountedPlayer.rotationYaw;
  }
}
Program: 169913
Project: 169913
Buggy source:
@Override public boolean onActivated(EntityPlayer entityPlayer){
  if (entityPlayer.isSneaking()) {
    this.tryActivateWeapon();
  }
 else {
    if (this.entityFake != null) {
      if (this.entityFake.riddenByEntity instanceof EntityPlayer) {
        EntityPlayer mountedPlayer=(EntityPlayer)this.entityFake.riddenByEntity;
        if (entityPlayer == mountedPlayer) {
          if (!this.worldObj.isRemote) {
            PacketManager.sendPacketToClients(this.getRotationPacket());
          }
          entityPlayer.mountEntity(null);
          this.entityFake.setDead();
          this.entityFake=null;
          return true;
        }
      }
      return false;
    }
 else {
      this.mount(entityPlayer);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onActivated(EntityPlayer entityPlayer){
  if (!entityPlayer.isSneaking()) {
    if (this.entityFake != null) {
      if (this.entityFake.riddenByEntity instanceof EntityPlayer) {
        this.tryActivateWeapon();
        if (!this.worldObj.isRemote) {
          PacketManager.sendPacketToClients(this.getRotationPacket());
        }
        return true;
      }
    }
  }
  this.mount(entityPlayer);
  return true;
}
Program: 169914
Project: 169914
Buggy source:
public void mount(EntityPlayer entityPlayer){
  if (!this.worldObj.isRemote) {
    if (this.entityFake == null) {
      this.entityFake=new EJia(this.worldObj,new Vector3(this.xCoord + 0.5,this.yCoord + 1.2,this.zCoord + 0.5),this,true);
      this.worldObj.spawnEntityInWorld(this.entityFake);
    }
    entityPlayer.rotationYaw=this.currentRotationYaw;
    entityPlayer.rotationPitch=this.currentRotationPitch;
    entityPlayer.mountEntity(this.entityFake);
  }
}

Fixed version (ground truth):
public void mount(EntityPlayer entityPlayer){
  if (!this.worldObj.isRemote) {
    entityPlayer.rotationYaw=this.currentRotationYaw;
    entityPlayer.rotationPitch=this.currentRotationPitch;
    entityPlayer.mountEntity(this.entityFake);
  }
}