Program: 12754
Project: 12754
Buggy source:
/** 
 * puts player to sleep on specified coffin if possible
 */
public EntityPlayer.EnumStatus sleepInCoffinAt(int x,int y,int z){
  Logger.i("String_Node_Str",String.format("String_Node_Str",x,y,z,this.isRemote()));
  if (!this.player.worldObj.isRemote) {
    if (this.sleepingCoffin || !this.isTheEntityAlive()) {
      return EntityPlayer.EnumStatus.OTHER_PROBLEM;
    }
    if (!this.player.worldObj.provider.isSurfaceWorld()) {
      return EntityPlayer.EnumStatus.NOT_POSSIBLE_HERE;
    }
    if (!this.player.worldObj.isDaytime()) {
      return EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW;
    }
    if (Math.abs(this.player.posX - x) > 3.0D || Math.abs(this.player.posY - y) > 2.0D || Math.abs(this.player.posZ - z) > 3.0D) {
      return EntityPlayer.EnumStatus.TOO_FAR_AWAY;
    }
    double d0=8.0D;
    double d1=5.0D;
    List list=this.player.worldObj.getEntitiesWithinAABB(EntityMob.class,AxisAlignedBB.getBoundingBox(x - d0,y - d1,z - d0,x + d0,y + d1,z + d0));
    if (!list.isEmpty()) {
      return EntityPlayer.EnumStatus.NOT_SAFE;
    }
  }
  if (this.player.isRiding()) {
    this.player.mountEntity((Entity)null);
  }
  Helper.Reflection.callMethod(Entity.class,this.player,Helper.Obfuscation.getPosNames("String_Node_Str"),new Class[]{float.class,float.class},new Object[]{0.2F,0.2F});
  this.player.yOffset=0.2F;
  if (this.player.worldObj.blockExists(x,y,z)) {
    int direction=((BlockCoffin)player.worldObj.getBlock(x,y,z)).getDirection(player.worldObj,x,y,z);
    float xOffset=0.5F;
    float zOffset=0.5F;
    float yOffset=0.5F;
switch (direction) {
case 0:
      zOffset=1.8F;
    break;
case 3:
  xOffset=1.8F;
break;
case 2:
zOffset=-0.8F;
break;
case 1:
xOffset=-0.8F;
}
this.func_71013_b(direction);
this.player.setPosition(x + xOffset,y + yOffset,z + zOffset);
Logger.i("String_Node_Str",String.format("String_Node_Str",xOffset,yOffset,zOffset));
}
 else {
this.player.setPosition(x + 0.5F,y + 0.9375F,z + 0.5F);
Logger.i("String_Node_Str","String_Node_Str");
}
S0APacketUseBed s0apacketusebed=new S0APacketUseBed(((EntityPlayerMP)this.player),x,y,z);
((EntityPlayerMP)this.player).getServerForPlayer().getEntityTracker().func_151247_a(((EntityPlayerMP)this.player),s0apacketusebed);
((EntityPlayerMP)this.player).playerNetServerHandler.setPlayerLocation(((EntityPlayerMP)this.player).posX,((EntityPlayerMP)this.player).posY,((EntityPlayerMP)this.player).posZ,((EntityPlayerMP)this.player).rotationYaw,((EntityPlayerMP)this.player).rotationPitch);
((EntityPlayerMP)this.player).playerNetServerHandler.sendPacket(s0apacketusebed);
Helper.Reflection.setPrivateField(EntityPlayer.class,this.player,true,Helper.Obfuscation.getPosNames("String_Node_Str"));
this.sleepingCoffin=true;
Logger.i("String_Node_Str","String_Node_Str" + this.sleepingCoffin);
Helper.Reflection.setPrivateField(EntityPlayer.class,this.player,0,Helper.Obfuscation.getPosNames("String_Node_Str"));
this.player.playerLocation=new ChunkCoordinates(x,y,z);
this.player.motionX=this.player.motionZ=this.player.motionY=0.0D;
if (!this.player.worldObj.isRemote) {
this.player.worldObj.updateAllPlayersSleepingFlag();
}
VampirePlayer.get(player).sync(true);
return EntityPlayer.EnumStatus.OK;
}

Fixed version (ground truth):
/** 
 * puts player to sleep on specified coffin if possible
 */
public EntityPlayer.EnumStatus sleepInCoffinAt(int x,int y,int z){
  Logger.i("String_Node_Str",String.format("String_Node_Str",x,y,z,this.isRemote()));
  if (!this.player.worldObj.isRemote) {
    if (this.sleepingCoffin || !this.isTheEntityAlive()) {
      Logger.w(TAG,"String_Node_Str");
      return EntityPlayer.EnumStatus.OTHER_PROBLEM;
    }
    if (!this.player.worldObj.provider.isSurfaceWorld()) {
      Logger.w(TAG,"String_Node_Str");
      return EntityPlayer.EnumStatus.NOT_POSSIBLE_HERE;
    }
    if (!this.player.worldObj.isDaytime()) {
      return EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW;
    }
    if (Math.abs(this.player.posX - x) > 3.0D || Math.abs(this.player.posY - y) > 2.0D || Math.abs(this.player.posZ - z) > 3.0D) {
      Logger.w(TAG,"String_Node_Str");
      return EntityPlayer.EnumStatus.TOO_FAR_AWAY;
    }
    double d0=8.0D;
    double d1=5.0D;
    List list=this.player.worldObj.getEntitiesWithinAABB(EntityMob.class,AxisAlignedBB.getBoundingBox(x - d0,y - d1,z - d0,x + d0,y + d1,z + d0));
    if (!list.isEmpty()) {
      return EntityPlayer.EnumStatus.NOT_SAFE;
    }
  }
  if (this.player.isRiding()) {
    this.player.mountEntity((Entity)null);
  }
  Helper.Reflection.callMethod(Entity.class,this.player,Helper.Obfuscation.getPosNames("String_Node_Str"),new Class[]{float.class,float.class},new Object[]{0.2F,0.2F});
  this.player.yOffset=0.2F;
  if (this.player.worldObj.blockExists(x,y,z)) {
    int direction=((BlockCoffin)player.worldObj.getBlock(x,y,z)).getDirection(player.worldObj,x,y,z);
    float xOffset=0.5F;
    float zOffset=0.5F;
    float yOffset=0.5F;
switch (direction) {
case 0:
      zOffset=1.8F;
    break;
case 3:
  xOffset=1.8F;
break;
case 2:
zOffset=-0.8F;
break;
case 1:
xOffset=-0.8F;
}
this.func_71013_b(direction);
this.player.setPosition(x + xOffset,y + yOffset,z + zOffset);
Logger.i("String_Node_Str",String.format("String_Node_Str",xOffset,yOffset,zOffset));
}
 else {
this.player.setPosition(x + 0.5F,y + 0.9375F,z + 0.5F);
Logger.i("String_Node_Str","String_Node_Str");
}
S0APacketUseBed s0apacketusebed=new S0APacketUseBed(((EntityPlayerMP)this.player),x,y,z);
((EntityPlayerMP)this.player).getServerForPlayer().getEntityTracker().func_151247_a(((EntityPlayerMP)this.player),s0apacketusebed);
((EntityPlayerMP)this.player).playerNetServerHandler.setPlayerLocation(((EntityPlayerMP)this.player).posX,((EntityPlayerMP)this.player).posY,((EntityPlayerMP)this.player).posZ,((EntityPlayerMP)this.player).rotationYaw,((EntityPlayerMP)this.player).rotationPitch);
((EntityPlayerMP)this.player).playerNetServerHandler.sendPacket(s0apacketusebed);
Helper.Reflection.setPrivateField(EntityPlayer.class,this.player,true,Helper.Obfuscation.getPosNames("String_Node_Str"));
this.sleepingCoffin=true;
Logger.i("String_Node_Str","String_Node_Str" + this.sleepingCoffin);
Helper.Reflection.setPrivateField(EntityPlayer.class,this.player,0,Helper.Obfuscation.getPosNames("String_Node_Str"));
this.player.playerLocation=new ChunkCoordinates(x,y,z);
this.player.motionX=this.player.motionZ=this.player.motionY=0.0D;
if (!this.player.worldObj.isRemote) {
this.player.worldObj.updateAllPlayersSleepingFlag();
}
VampirePlayer.get(player).sync(true);
return EntityPlayer.EnumStatus.OK;
}